/// <summary>
        /// Create map create operation.
        /// Server creates map at given context level.
        /// </summary>
        public static Operation Create(string binName, MapOrder order, params CTX[] ctx)
        {
            // If context not defined, the set order for top-level bin map.
            if (ctx == null || ctx.Length == 0)
            {
                return(SetMapPolicy(new MapPolicy(order, MapWriteMode.UPDATE), binName));
            }

            Packer packer = new Packer();

            CDT.Init(packer, ctx, SET_TYPE, 1, CTX.GetFlag(order));
            packer.PackNumber((int)order);
            return(new Operation(Operation.Type.MAP_MODIFY, binName, Value.Get(packer.ToByteArray())));
        }
Beispiel #2
0
        /// <summary>
        /// Create list create operation.
        /// Server creates list at given context level. The context is allowed to be beyond list
        /// boundaries only if pad is set to true.  In that case, nil list entries will be inserted to
        /// satisfy the context position.
        /// </summary>
        public static Operation Create(string binName, ListOrder order, bool pad, params CTX[] ctx)
        {
            // If context not defined, the set order for top-level bin list.
            if (ctx == null || ctx.Length == 0)
            {
                return(SetOrder(binName, order));
            }

            Packer packer = new Packer();

            CDT.Init(packer, ctx, SET_TYPE, 1, CTX.GetFlag(order, pad));
            packer.PackNumber((int)order);
            return(new Operation(Operation.Type.CDT_MODIFY, binName, Value.Get(packer.ToByteArray())));
        }