|
@@ -99,6 +99,7 @@ const int ZOOKEEPER_READ = 1 << 1;
|
|
|
|
|
|
const int ZOO_EPHEMERAL = 1 << 0;
|
|
const int ZOO_EPHEMERAL = 1 << 0;
|
|
const int ZOO_SEQUENCE = 1 << 1;
|
|
const int ZOO_SEQUENCE = 1 << 1;
|
|
|
|
+const int ZOO_CONTAINER = 1 << 2;
|
|
|
|
|
|
const int ZOO_EXPIRED_SESSION_STATE = EXPIRED_SESSION_STATE_DEF;
|
|
const int ZOO_EXPIRED_SESSION_STATE = EXPIRED_SESSION_STATE_DEF;
|
|
const int ZOO_AUTH_FAILED_STATE = AUTH_FAILED_STATE_DEF;
|
|
const int ZOO_AUTH_FAILED_STATE = AUTH_FAILED_STATE_DEF;
|
|
@@ -108,6 +109,8 @@ const int ZOO_CONNECTED_STATE = CONNECTED_STATE_DEF;
|
|
const int ZOO_READONLY_STATE = READONLY_STATE_DEF;
|
|
const int ZOO_READONLY_STATE = READONLY_STATE_DEF;
|
|
const int ZOO_NOTCONNECTED_STATE = NOTCONNECTED_STATE_DEF;
|
|
const int ZOO_NOTCONNECTED_STATE = NOTCONNECTED_STATE_DEF;
|
|
|
|
|
|
|
|
+#define ZOOKEEPER_IS_CONTAINER(flags) (((flags) & ZOO_CONTAINER) == ZOO_CONTAINER)
|
|
|
|
+
|
|
static __attribute__ ((unused)) const char* state2String(int state){
|
|
static __attribute__ ((unused)) const char* state2String(int state){
|
|
switch(state){
|
|
switch(state){
|
|
case 0:
|
|
case 0:
|
|
@@ -3545,7 +3548,7 @@ int zoo_acreate(zhandle_t *zh, const char *path, const char *value,
|
|
string_completion_t completion, const void *data)
|
|
string_completion_t completion, const void *data)
|
|
{
|
|
{
|
|
struct oarchive *oa;
|
|
struct oarchive *oa;
|
|
- struct RequestHeader h = {get_xid(), ZOO_CREATE_OP};
|
|
|
|
|
|
+ struct RequestHeader h = {get_xid(), ZOOKEEPER_IS_CONTAINER(flags) ? ZOO_CREATE_CONTAINER_OP : ZOO_CREATE_OP};
|
|
struct CreateRequest req;
|
|
struct CreateRequest req;
|
|
|
|
|
|
int rc = CreateRequest_init(zh, &req,
|
|
int rc = CreateRequest_init(zh, &req,
|
|
@@ -3577,7 +3580,7 @@ int zoo_acreate2(zhandle_t *zh, const char *path, const char *value,
|
|
string_stat_completion_t completion, const void *data)
|
|
string_stat_completion_t completion, const void *data)
|
|
{
|
|
{
|
|
struct oarchive *oa;
|
|
struct oarchive *oa;
|
|
- struct RequestHeader h = { get_xid(), ZOO_CREATE2_OP };
|
|
|
|
|
|
+ struct RequestHeader h = { get_xid(), ZOOKEEPER_IS_CONTAINER(flags) ? ZOO_CREATE_CONTAINER_OP : ZOO_CREATE2_OP };
|
|
struct CreateRequest req;
|
|
struct CreateRequest req;
|
|
|
|
|
|
int rc = CreateRequest_init(zh, &req, path, value, valuelen, acl_entries, flags);
|
|
int rc = CreateRequest_init(zh, &req, path, value, valuelen, acl_entries, flags);
|
|
@@ -3942,6 +3945,7 @@ int zoo_amulti(zhandle_t *zh, int count, const zoo_op_t *ops,
|
|
rc = rc < 0 ? rc : serialize_MultiHeader(oa, "multiheader", &mh);
|
|
rc = rc < 0 ? rc : serialize_MultiHeader(oa, "multiheader", &mh);
|
|
|
|
|
|
switch(op->type) {
|
|
switch(op->type) {
|
|
|
|
+ case ZOO_CREATE_CONTAINER_OP:
|
|
case ZOO_CREATE_OP: {
|
|
case ZOO_CREATE_OP: {
|
|
struct CreateRequest req;
|
|
struct CreateRequest req;
|
|
|
|
|
|
@@ -4124,7 +4128,7 @@ void zoo_create_op_init(zoo_op_t *op, const char *path, const char *value,
|
|
char *path_buffer, int path_buffer_len)
|
|
char *path_buffer, int path_buffer_len)
|
|
{
|
|
{
|
|
assert(op);
|
|
assert(op);
|
|
- op->type = ZOO_CREATE_OP;
|
|
|
|
|
|
+ op->type = ZOOKEEPER_IS_CONTAINER(flags) ? ZOO_CREATE_CONTAINER_OP : ZOO_CREATE_OP;
|
|
op->create_op.path = path;
|
|
op->create_op.path = path;
|
|
op->create_op.data = value;
|
|
op->create_op.data = value;
|
|
op->create_op.datalen = valuelen;
|
|
op->create_op.datalen = valuelen;
|
|
@@ -4139,7 +4143,7 @@ void zoo_create2_op_init(zoo_op_t *op, const char *path, const char *value,
|
|
char *path_buffer, int path_buffer_len)
|
|
char *path_buffer, int path_buffer_len)
|
|
{
|
|
{
|
|
assert(op);
|
|
assert(op);
|
|
- op->type = ZOO_CREATE2_OP;
|
|
|
|
|
|
+ op->type = ZOOKEEPER_IS_CONTAINER(flags) ? ZOO_CREATE_CONTAINER_OP : ZOO_CREATE2_OP;
|
|
op->create_op.path = path;
|
|
op->create_op.path = path;
|
|
op->create_op.data = value;
|
|
op->create_op.data = value;
|
|
op->create_op.datalen = valuelen;
|
|
op->create_op.datalen = valuelen;
|