The Zookeeper class

(PECL zookeeper >= 0.1.0)

Einführung

Represents ZooKeeper session.

Klassenbeschreibung

class Zookeeper {
/* Methoden */
public __construct(string $host = '', callable $watcher_cb = null, int $recv_timeout = 10000)
public addAuth(string $scheme, string $cert, callable $completion_cb = null): bool
public close(): void
public connect(string $host, callable $watcher_cb = null, int $recv_timeout = 10000): void
public create(
    string $path,
    string $value,
    array $acls,
    int $flags = null
): string
public delete(string $path, int $version = -1): bool
public exists(string $path, callable $watcher_cb = null): array
public get(
    string $path,
    callable $watcher_cb = null,
    array &$stat = null,
    int $max_size = 0
): string
public getAcl(string $path): array
public getChildren(string $path, callable $watcher_cb = null): array
public getClientId(): int
public getRecvTimeout(): int
public getState(): int
public isRecoverable(): bool
public set(
    string $path,
    string $value,
    int $version = -1,
    array &$stat = null
): bool
public setAcl(string $path, int $version, array $acl): bool
public static setDebugLevel(int $logLevel): bool
public static setDeterministicConnOrder(bool $yesOrNo): bool
public setLogStream(resource $stream): bool
public setWatcher(callable $watcher_cb): bool
/* Konstanten */
const int PERM_READ = 1;
const int PERM_WRITE = 2;
const int PERM_CREATE = 4;
const int PERM_DELETE = 8;
const int PERM_ADMIN = 16;
const int PERM_ALL = 31;
const int EPHEMERAL = 1;
const int SEQUENCE = 2;
const int LOG_LEVEL_ERROR = 1;
const int LOG_LEVEL_WARN = 2;
const int LOG_LEVEL_INFO = 3;
const int LOG_LEVEL_DEBUG = 4;
const int EXPIRED_SESSION_STATE = -112;
const int AUTH_FAILED_STATE = -113;
const int CONNECTING_STATE = 1;
const int ASSOCIATING_STATE = 2;
const int CONNECTED_STATE = 3;
const int READONLY_STATE = 5;
const int NOTCONNECTED_STATE = 999;
const int CREATED_EVENT = 1;
const int DELETED_EVENT = 2;
const int CHANGED_EVENT = 3;
const int CHILD_EVENT = 4;
const int SESSION_EVENT = -1;
const int NOTWATCHING_EVENT = -2;
const int SYSTEMERROR = -1;
const int RUNTIMEINCONSISTENCY = -2;
const int DATAINCONSISTENCY = -3;
const int CONNECTIONLOSS = -4;
const int MARSHALLINGERROR = -5;
const int UNIMPLEMENTED = -6;
const int OPERATIONTIMEOUT = -7;
const int BADARGUMENTS = -8;
const int INVALIDSTATE = -9;
const int NEWCONFIGNOQUORUM = -13;
const int RECONFIGINPROGRESS = -14;
const int OK = 0;
const int APIERROR = -100;
const int NONODE = -101;
const int NOAUTH = -102;
const int BADVERSION = -103;
const int NOCHILDRENFOREPHEMERALS = -108;
const int NODEEXISTS = -110;
const int NOTEMPTY = -111;
const int SESSIONEXPIRED = -112;
const int INVALIDCALLBACK = -113;
const int INVALIDACL = -114;
const int AUTHFAILED = -115;
const int CLOSING = -116;
const int NOTHING = -117;
const int SESSIONMOVED = -118;
const int NOTREADONLY = -119;
const int EPHEMERALONLOCALSESSION = -120;
const int NOWATCHER = -121;
const int RECONFIGDISABLED = -122;
}

Vordefinierte Konstanten

ZooKeeper Permissions

Zookeeper::PERM_READ

Can read nodes value and list its children

Zookeeper::PERM_WRITE

Can set the nodes value

Zookeeper::PERM_CREATE

Can create children

Zookeeper::PERM_DELETE

Can delete children

Zookeeper::PERM_ADMIN

Can execute set_acl()

Zookeeper::PERM_ALL

All of the above flags ORd together

ZooKeeper Create Flags

Zookeeper::EPHEMERAL

If Zookeeper::EPHEMERAL flag is set, the node will automatically get removed if the client session goes away.

Zookeeper::SEQUENCE

If the Zookeeper::SEQUENCE flag is set, a unique monotonically increasing sequence number is appended to the path name. The sequence number is always fixed length of 10 digits, 0 padded.

ZooKeeper Log Levels

Zookeeper::LOG_LEVEL_ERROR

Outputs only error mesages

Zookeeper::LOG_LEVEL_WARN

Outputs errors/warnings

Zookeeper::LOG_LEVEL_INFO

Outputs big action messages besides errors/warnings

Zookeeper::LOG_LEVEL_DEBUG

Outputs all

ZooKeeper States

Zookeeper::EXPIRED_SESSION_STATE

Connected but session expired

Zookeeper::AUTH_FAILED_STATE

Connected but auth failed

Zookeeper::CONNECTING_STATE

Connecting

Zookeeper::ASSOCIATING_STATE

Associating

Zookeeper::CONNECTED_STATE

Connected

Zookeeper::READONLY_STATE

TODO: help us improve this extension.

Zookeeper::NOTCONNECTED_STATE

Connection failed

ZooKeeper Watch Types

Zookeeper::CREATED_EVENT

A node has been created

This is only generated by watches on non-existent nodes. These watches are set using Zookeeper::exists.

Zookeeper::DELETED_EVENT

A node has been deleted

This is only generated by watches on nodes. These watches are set using Zookeeper::exists and Zookeeper::get.

Zookeeper::CHANGED_EVENT

A node has changed

This is only generated by watches on nodes. These watches are set using Zookeeper::exists and Zookeeper::get.

Zookeeper::CHILD_EVENT

A change as occurred in the list of children

This is only generated by watches on the child list of a node. These watches are set using Zookeeper::getChildren.

Zookeeper::SESSION_EVENT

A session has been lost

This is generated when a client loses contact or reconnects with a server.

Zookeeper::NOTWATCHING_EVENT

A watch has been removed

This is generated when the server for some reason, probably a resource constraint, will no longer watch a node for a client.

ZooKeeper System and Server-side Errors

Zookeeper::SYSTEMERROR

This is never thrown by the server, it shouldn't be used other than to indicate a range. Specifically error codes greater than this value, but lesser than Zookeeper::APIERROR, are system errors.

Zookeeper::RUNTIMEINCONSISTENCY

A runtime inconsistency was found.

Zookeeper::DATAINCONSISTENCY

A data inconsistency was found.

Zookeeper::CONNECTIONLOSS

Connection to the server has been lost.

Zookeeper::MARSHALLINGERROR

Error while marshalling or unmarshalling data.

Zookeeper::UNIMPLEMENTED

Operation is unimplemented.

Zookeeper::OPERATIONTIMEOUT

Operation timeout.

Zookeeper::BADARGUMENTS

Invalid arguments.

Zookeeper::INVALIDSTATE

Invliad zhandle state.

Zookeeper::NEWCONFIGNOQUORUM

No quorum of new config is connected and up-to-date with the leader of last committed config - try invoking reconfiguration after new servers are connected and synced.

Available as of ZooKeeper 3.5.0

Zookeeper::RECONFIGINPROGRESS

Reconfiguration requested while another reconfiguration is currently in progress. This is currently not supported. Please retry.

Available as of ZooKeeper 3.5.0

ZooKeeper API Errors

Zookeeper::OK

Everything is OK.

Zookeeper::APIERROR

This is never thrown by the server, it shouldn't be used other than to indicate a range. Specifically error codes greater than this value are API errors (while values less than this indicate a Zookeeper::SYSTEMERROR).

Zookeeper::NONODE

Node does not exist.

Zookeeper::NOAUTH

Not authenticated.

Zookeeper::BADVERSION

Version conflict.

Zookeeper::NOCHILDRENFOREPHEMERALS

Ephemeral nodes may not have children.

Zookeeper::NODEEXISTS

The node already exists.

Zookeeper::NOTEMPTY

The node has children.

Zookeeper::SESSIONEXPIRED

The session has been expired by the server.

Zookeeper::INVALIDCALLBACK

Invalid callback specified.

Zookeeper::INVALIDACL

Invalid ACL specified.

Zookeeper::AUTHFAILED

Client authentication failed.

Zookeeper::CLOSING

ZooKeeper is closing.

Zookeeper::NOTHING

(not error) No server responses to process.

Zookeeper::SESSIONMOVED

Session moved to another server, so operation is ignored.

Zookeeper::NOTREADONLY

State-changing request is passed to read-only server.

Zookeeper::EPHEMERALONLOCALSESSION

Attempt to create ephemeral node on a local session.

Zookeeper::NOWATCHER

The watcher couldn't be found.

Zookeeper::RECONFIGDISABLED

Attempts to perform a reconfiguration operation when reconfiguration feature is disabled.

Inhaltsverzeichnis

Hier Kannst Du einen Kommentar verfassen


Bitte gib mindestens 10 Zeichen ein.
Wird geladen... Bitte warte.
* Pflichtangabe
Es sind noch keine Kommentare vorhanden.

PHP cURL-Tutorial: Verwendung von cURL zum Durchführen von HTTP-Anfragen

cURL ist eine leistungsstarke PHP-Erweiterung, die es Ihnen ermöglicht, mit verschiedenen Servern über verschiedene Protokolle wie HTTP, HTTPS, FTP und mehr zu kommunizieren. ...

TheMax

Autor : TheMax
Kategorie: PHP-Tutorials

Midjourney Tutorial - Anleitung für Anfänger

Über Midjourney, dem Tool zur Erstellung digitaler Bilder mithilfe von künstlicher Intelligenz, gibt es ein informatives Video mit dem Titel "Midjourney Tutorial auf Deutsch - Anleitung für Anfänger" ...

Mike94

Autor : Mike94
Kategorie: KI Tutorials

Grundlagen von Views in MySQL

Views in einer MySQL-Datenbank bieten die Möglichkeit, eine virtuelle Tabelle basierend auf dem Ergebnis einer SQL-Abfrage zu erstellen. ...

admin

Autor : admin
Kategorie: mySQL-Tutorials

Tutorial veröffentlichen

Tutorial veröffentlichen

Teile Dein Wissen mit anderen Entwicklern weltweit

Du bist Profi in deinem Bereich und möchtest dein Wissen teilen, dann melde dich jetzt an und teile es mit unserer PHP-Community

mehr erfahren

Tutorial veröffentlichen

Ein data POST via Curl funktioniert nicht.

Anmorg93 Respekt, du bist ja nur um rund 10 Jahre zu spät dran.

Geschrieben von scatello am 21.11.2024 10:57:00
Forum: PHP Developer Forum
Ein data POST via Curl funktioniert nicht.

Hey, hatte auch mal das Problem. Oft liegt’s an fehlenden oder falschen Headern. Probier mal:​ $ch = curl_init(); curl_setopt($ch, CURLOPT_UR ...

Geschrieben von Anmorg93 am 21.11.2024 10:48:17
Forum: PHP Developer Forum
Probleme mit einem Linux-Befehl...

guten Tag liebe Community ;) hallo liebe Freunde auf der php-Ressource, hoffe, das landet im richtigen Unterforum also, womit ich im Moment zu ...

Geschrieben von dhubs am 15.11.2024 16:21:52
Forum: Off-Topic Diskussionen
ein .htaccess-File für eine WordPress-Installation - wie gehe ich hier vor.?

hallo und guten Tag, wie lege ich denn einen .htaccess für eine WordPress-Installation an - wie gehe ich hier vor. Kann man das denn so mache ...

Geschrieben von dhubs am 13.11.2024 15:52:54
Forum: Webmaster