Exemplo n.º 1
0
        /// <summary>
        /// Create a new object representing a binary large object (blob).
        /// Only keys within the subspace will be used by the object.
        /// Other clients of the database should refrain from modifying the subspace.</summary>
        /// <param name="location">Subspace to be used for storing the blob data and metadata</param>
        public FdbBlob(ISubspaceLocation location)
        {
            if (location == null)
            {
                throw new ArgumentNullException(nameof(location));
            }

            this.Location = location.AsDynamic();
        }
Exemplo n.º 2
0
        // from https://apple.github.io/foundationdb/vector.html

        // Vector stores each of its values using its index as the key.
        // The size of a vector is equal to the index of its last key + 1.
        //
        // For indexes smaller than the vector's size that have no associated key
        // in the database, the value will be the specified defaultValue.
        //
        // If the last value in the vector has the default value, its key will
        // always be set so that size can be determined.
        //
        // By creating Vector with a Subspace, all kv pairs modified by the
        // layer will have keys that start within that Subspace.

        // Implementation note:
        // - vector.py uses Thread Local Storage that does not work well with async and Tasks in .NET
        //   so we wont be able to 'store' the current transaction in the vector object itself

        /// <summary>Create a new sparse Vector</summary>
        /// <param name="location">Subspace where the vector will be stored</param>
        /// <param name="defaultValue">Default value for sparse entries</param>
        /// <param name="encoder">Encoder used for the values of this vector</param>
        public FdbVector(ISubspaceLocation location, T defaultValue = default, IValueEncoder <T>?encoder = null)
            : this(location.AsDynamic(), defaultValue, encoder)
        {
        }
        private const int LEVEL_FAN_POW = 4;         // 2^X per level

        public FdbRankedSet(ISubspaceLocation location)
            : this(location?.AsDynamic())
        {
        }
 /// <summary>Create a new High Contention counter.</summary>
 /// <param name="location">Subspace to be used for storing the counter</param>
 public FdbHighContentionCounter(ISubspaceLocation location)
     : this(location.AsDynamic(), TuPack.Encoding.GetValueEncoder <long>())
 {
 }