Vostok.ZooKeeper
  • Overview
  • Quickstart
  • Basics
    • Creating a Client
    • Connecting to a ZooKeeper Cluster
    • Using Client
    • Limitations
  • Operations
    • Common Concepts
    • Creating a Node
    • Deleting a Node
    • Probing Node Existence
    • Getting Children of a Node
    • Getting of a Node Data
    • Setting of a Node Data
  • Observing Node Events
  • Recipes
    • Distributed Lock
Powered by GitBook
On this page
  1. Operations

Setting of a Node Data

It is possible to associate some binary data with a node using SetDataAsync. Its request model accepts an array of bytes of size no more than 1024*1023. If that size is exceeded, ArgumentException will be thrown upon request.

client.SetData(new ("/node/with/data", new byte[1]) { Version = 2 })

If node does not exist, request will fail with NodeNotFound status.

Node Version

Every setting of node data increments a version of that node which can be found in NodeStat.Version. Deletion of a node resets its version.

In SetDataRequest one can specify an expected version of node. If an actual version differs from expected, request will fail with VersionsMismatch and node will remain unchanged.

PreviousGetting of a Node DataNextObserving Node Events

Last updated 3 years ago