Ejemplo n.º 1
0
 /// <summary>
 /// Create list get range operation.
 /// Server returns "count" items starting at specified index in list bin.
 /// </summary>
 public static Operation GetRange(string binName, int index, int count, params CTX[] ctx)
 {
     byte[] bytes = PackUtil.Pack(ListOperation.GET_RANGE, index, count, ctx);
     return(new Operation(Operation.Type.CDT_READ, binName, Value.Get(bytes)));
 }
Ejemplo n.º 2
0
 /// <summary>
 /// Constructor, specifying bin name and unsigned short value.
 /// The server will convert all shorts to longs.
 /// For servers configured as "single-bin", enter a null or empty name.
 /// </summary>
 /// <param name="name">bin name, current limit is 14 characters</param>
 /// <param name="value">bin value</param>
 public Bin(string name, ushort value)
 {
     this.name  = name;
     this.value = Value.Get(value);
 }
Ejemplo n.º 3
0
 /// <summary>
 /// Create bin with a map value.  The map value will be serialized as a server map type.
 /// For servers configured as "single-bin", enter a null or empty name.
 /// </summary>
 /// <param name="name">bin name, current limit is 14 characters</param>
 /// <param name="value">bin value</param>
 public Bin(string name, IDictionary value)
 {
     this.name  = name;
     this.value = Value.Get(value);
 }
Ejemplo n.º 4
0
 /// <summary>
 /// Select values from list and apply specified Lua filter.
 /// </summary>
 /// <param name="filterModule">Lua module name which contains filter function</param>
 /// <param name="filterName">Lua function name which applies filter to returned list</param>
 /// <param name="filterArgs">arguments to Lua function name</param>
 public IList Filter(string filterModule, string filterName, params Value[] filterArgs)
 {
     return((IList)client.Execute(policy, key, PackageName, "filter", binName, Value.AsNull, Value.Get(filterModule), Value.Get(filterName), Value.Get(filterArgs)));
 }
Ejemplo n.º 5
0
 /// <summary>
 /// Add values to list.  Fail if a value's key exists and list is configured for unique keys.
 /// If value is a map, the key is identified by "key" entry.  Otherwise, the value is the key.
 /// If large list does not exist, create it.
 /// </summary>
 /// <param name="values">values to add</param>
 public void Add(IList values)
 {
     client.Execute(policy, key, PackageName, "add_all", binName, Value.Get(values));
 }
Ejemplo n.º 6
0
 /// <summary>
 /// Select values from the end of list up to a maximum count after applying Lua filter.
 /// Supported by server versions >= 3.5.8.
 /// </summary>
 /// <param name="count">maximum number of values to return after applying Lua filter</param>
 /// <param name="filterModule">Lua module name which contains filter function</param>
 /// <param name="filterName">Lua function name which applies filter to returned list</param>
 /// <param name="filterArgs">arguments to Lua function name</param>
 public IList FindLast(int count, string filterModule, string filterName, params Value[] filterArgs)
 {
     return((IList)client.Execute(policy, key, PackageName, "find_last", binName, Value.Get(count), Value.Get(filterModule), Value.Get(filterName), Value.Get(filterArgs)));
 }
Ejemplo n.º 7
0
 /// <summary>
 /// Select range of values from list.
 /// Supported by server versions >= 3.5.8.
 /// </summary>
 /// <param name="begin">low value of the range (inclusive)</param>
 /// <param name="end">high value of the range (inclusive)</param>
 /// <param name="count">maximum number of values to return, pass in zero to obtain all values within range</param>
 public IList Range(Value begin, Value end, int count)
 {
     return((IList)client.Execute(policy, key, PackageName, "find_range", binName, begin, end, Value.Get(count)));
 }
Ejemplo n.º 8
0
 /// <summary>
 /// Select items from map.
 /// </summary>
 /// <param name="filterModule">Lua module name which contains filter function</param>
 /// <param name="filterName">Lua function name which applies filter to returned list</param>
 /// <param name="filterArgs">arguments to Lua function name</param>
 public IDictionary Filter(string filterModule, string filterName, params Value[] filterArgs)
 {
     return((IDictionary)client.Execute(policy, key, PackageName, "filter", binName, Value.Get(filterModule), Value.Get(filterName), Value.Get(filterArgs)));
 }
Ejemplo n.º 9
0
 /// <summary>
 /// Add map values to map.  If the map does not exist, create it using specified userModule configuration.
 /// </summary>
 /// <param name="map">map values to push</param>
 public void Put(IDictionary map)
 {
     client.Execute(policy, key, PackageName, "put_all", binName, Value.Get(map), createModule);
 }
Ejemplo n.º 10
0
 /// <summary>
 /// Create list get by rank range operation.
 /// Server selects "count" list items starting at specified rank and returns selected data specified by returnType.
 /// </summary>
 public static Operation GetByRankRange(string binName, int rank, int count, ListReturnType returnType, params CTX[] ctx)
 {
     byte[] bytes = PackUtil.Pack(ListOperation.GET_BY_RANK_RANGE, (int)returnType, rank, count, ctx);
     return(new Operation(Operation.Type.CDT_READ, binName, Value.Get(bytes)));
 }
Ejemplo n.º 11
0
 /// <summary>
 /// Create list increment operation with policy.
 /// Server increments list[index] by 1.
 /// Server returns list[index] after incrementing.
 /// </summary>
 public static Operation Increment(ListPolicy policy, string binName, int index, params CTX[] ctx)
 {
     return(CDT.CreateOperation(INCREMENT, Operation.Type.CDT_MODIFY, binName, ctx, index, Value.Get(1), policy.attributes, policy.flags));
 }
Ejemplo n.º 12
0
 /// <summary>
 /// Create list get by index range operation.
 /// Server selects list items starting at specified index to the end of list and returns selected
 /// data specified by returnType.
 /// </summary>
 public static Operation GetByIndexRange(string binName, int index, ListReturnType returnType, params CTX[] ctx)
 {
     byte[] bytes = PackUtil.Pack(ListOperation.GET_BY_INDEX_RANGE, (int)returnType, index, ctx);
     return(new Operation(Operation.Type.CDT_READ, binName, Value.Get(bytes)));
 }
Ejemplo n.º 13
0
 /// <summary>
 /// Create list get by value list operation.
 /// Server selects list items identified by values and returns selected data specified by returnType.
 /// </summary>
 public static Operation GetByValueList(string binName, IList values, ListReturnType returnType, params CTX[] ctx)
 {
     byte[] bytes = PackUtil.Pack(ListOperation.GET_BY_VALUE_LIST, (int)returnType, values, ctx);
     return(new Operation(Operation.Type.CDT_READ, binName, Value.Get(bytes)));
 }
Ejemplo n.º 14
0
 /// <summary>
 /// Create list get by value range operation.
 /// Server selects list items identified by value range (valueBegin inclusive, valueEnd exclusive)
 /// If valueBegin is null, the range is less than valueEnd.
 /// If valueEnd is null, the range is greater than equal to valueBegin.
 /// <para>
 /// Server returns selected data specified by returnType.
 /// </para>
 /// </summary>
 public static Operation GetByValueRange(string binName, Value valueBegin, Value valueEnd, ListReturnType returnType, params CTX[] ctx)
 {
     byte[] bytes = CDT.PackRangeOperation(ListOperation.GET_BY_VALUE_INTERVAL, (int)returnType, valueBegin, valueEnd, ctx);
     return(new Operation(Operation.Type.CDT_READ, binName, Value.Get(bytes)));
 }
Ejemplo n.º 15
0
 /// <summary>
 /// Select values from list and apply specified Lua filter.
 /// </summary>
 /// <param name="value">value to select</param>
 /// <param name="filterModule">Lua module name which contains filter function</param>
 /// <param name="filterName">Lua function name which applies filter to returned list</param>
 /// <param name="filterArgs">arguments to Lua function name</param>
 public IList FindThenFilter(Value value, string filterModule, string filterName, params Value[] filterArgs)
 {
     return((IList)client.Execute(policy, key, PackageName, "find_then_filter", binName, value, Value.Get(filterModule), Value.Get(filterName), Value.Get(filterArgs)));
 }
Ejemplo n.º 16
0
 public static Bin AsList(string name, IList value)
 {
     return(new Bin(name, Value.Get(value)));
 }
Ejemplo n.º 17
0
 /// <summary>
 /// Select values from the end of list up to a maximum count.
 /// Supported by server versions >= 3.5.8.
 /// </summary>
 /// <param name="count">maximum number of values to return</param>
 public IList FindLast(int count)
 {
     return((IList)client.Execute(policy, key, PackageName, "find_last", binName, Value.Get(count)));
 }
Ejemplo n.º 18
0
 public static Bin AsMap(string name, IDictionary value)
 {
     return(new Bin(name, Value.Get(value)));
 }
Ejemplo n.º 19
0
 /// <summary>
 /// Select values from the begin key up to a maximum count.
 /// Supported by server versions >= 3.5.8.
 /// </summary>
 /// <param name="begin">start value (inclusive)</param>
 /// <param name="count">maximum number of values to return</param>
 public IList FindFrom(Value begin, int count)
 {
     return((IList)client.Execute(policy, key, PackageName, "find_from", binName, begin, Value.Get(count)));
 }
Ejemplo n.º 20
0
 /// <summary>
 /// Constructor, specifying bin name and byte array segment value.
 /// For servers configured as "single-bin", enter a null or empty name.
 /// </summary>
 /// <param name="name">bin name, current limit is 14 characters</param>
 /// <param name="value">byte array value</param>
 /// <param name="offset">byte array segment offset</param>
 /// <param name="length">byte array segment length</param>
 public Bin(string name, byte[] value, int offset, int length)
 {
     this.name  = name;
     this.value = Value.Get(value, offset, length);
 }
Ejemplo n.º 21
0
 /// <summary>
 /// Select range of values from the large list up to a maximum count after applying lua filter.
 /// Supported by server versions >= 3.5.8.
 /// </summary>
 /// <param name="begin">low value of the range (inclusive)</param>
 /// <param name="end">high value of the range (inclusive)</param>
 /// <param name="count">maximum number of values to return after applying lua filter. Pass in zero to obtain all values within range.</param>
 /// <param name="filterModule">Lua module name which contains filter function</param>
 /// <param name="filterName">Lua function name which applies filter to returned list</param>
 /// <param name="filterArgs">arguments to Lua function name</param>
 public IList Range(Value begin, Value end, int count, string filterModule, string filterName, params Value[] filterArgs)
 {
     return((IList)client.Execute(policy, key, PackageName, "find_range", binName, begin, end, Value.Get(count), Value.Get(filterModule), Value.Get(filterName), Value.Get(filterArgs)));
 }
 /// <summary>
 /// Set maximum number of entries in the set.
 /// </summary>
 /// <param name="capacity">max entries in set </param>
 public void SetCapacity(int capacity)
 {
     client.Execute(policy, key, PackageName, "set_capacity", binName, Value.Get(capacity));
 }
Ejemplo n.º 23
0
 /// <summary>
 /// Set LDT page size.
 /// Supported by server versions >= 3.5.8.
 /// </summary>
 /// <param name="pageSize">page size in bytes</param>
 public void SetPageSize(int pageSize)
 {
     client.Execute(policy, key, PackageName, "setPageSize", binName, Value.Get(pageSize));
 }
 /// <summary>
 /// Add values to the set.  If the set does not exist, create it using specified userModule configuration.
 /// </summary>
 /// <param name="values">values to add</param>
 public void Add(params Value[] values)
 {
     client.Execute(policy, key, PackageName, "add_all", binName, Value.Get(values), createModule);
 }
Ejemplo n.º 25
0
 /// <summary>
 /// Update/Add each value in array depending if key exists or not.
 /// If value is a map, the key is identified by "key" entry.  Otherwise, the value is the key.
 /// If large list does not exist, create it.
 /// </summary>
 /// <param name="values">values to update</param>
 public void Update(params Value[] values)
 {
     client.Execute(policy, key, PackageName, "update_all", binName, Value.Get(values));
 }
Ejemplo n.º 26
0
 /// <summary>
 /// Delete values from list.
 /// </summary>
 /// <param name="values">values to delete</param>
 public void Remove(IList values)
 {
     client.Execute(policy, key, PackageName, "remove_all", binName, Value.Get(values));
 }
Ejemplo n.º 27
0
 /// <summary>
 /// Constructor, specifying bin name and signed byte value.
 /// The server will convert all byte integers to longs.
 /// For servers configured as "single-bin", enter a null or empty name.
 /// </summary>
 /// <param name="name">bin name, current limit is 14 characters</param>
 /// <param name="value">bin value</param>
 public Bin(string name, sbyte value)
 {
     this.name  = name;
     this.value = Value.Get(value);
 }
Ejemplo n.º 28
0
        /// <summary>
        /// Do key values exist?  Return list of results in one batch call.
        /// </summary>
        /// <param name="keyValues">key values to lookup</param>
        public IList <bool> Exists(IList keyValues)
        {
            IList list = (IList)client.Execute(policy, key, PackageName, "exists", binName, Value.Get(keyValues));

            if (list != null)
            {
                IList <bool> target = new List <bool>(list.Count);

                foreach (object obj in list)
                {
                    target.Add(Util.ToBool(obj));
                }
                return(target);
            }
            else
            {
                int          max    = keyValues.Count;
                IList <bool> target = new List <bool>(max);

                for (int i = 0; i < max; i++)
                {
                    target.Add(false);
                }
                return(target);
            }
        }
Ejemplo n.º 29
0
 /// <summary>
 /// Constructor, specifying bin name and object value.
 /// This is the slowest of the Bin constructors because the type
 /// must be determined using multiple "instanceof" checks.
 /// <para>
 /// For servers configured as "single-bin", enter a null or empty name.
 /// </para>
 /// </summary>
 /// <param name="name">bin name, current limit is 14 characters</param>
 /// <param name="value">bin value</param>
 public Bin(string name, object value)
 {
     this.name  = name;
     this.value = Value.Get(value);
 }
Ejemplo n.º 30
0
 /// <summary>
 /// Create list size operation.
 /// Server returns size of list.
 /// </summary>
 public static Operation Size(string binName, params CTX[] ctx)
 {
     byte[] bytes = PackUtil.Pack(ListOperation.SIZE, ctx);
     return(new Operation(Operation.Type.CDT_READ, binName, Value.Get(bytes)));
 }