/// <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))); }
/// <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); }
/// <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); }
/// <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))); }
/// <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)); }
/// <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))); }
/// <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))); }
/// <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))); }
/// <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); }
/// <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))); }
/// <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)); }
/// <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))); }
/// <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))); }
/// <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))); }
/// <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))); }
public static Bin AsList(string name, IList value) { return(new Bin(name, Value.Get(value))); }
/// <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))); }
public static Bin AsMap(string name, IDictionary value) { return(new Bin(name, Value.Get(value))); }
/// <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))); }
/// <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); }
/// <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)); }
/// <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); }
/// <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)); }
/// <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)); }
/// <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); }
/// <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); } }
/// <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); }
/// <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))); }