Exemplo n.º 1
0
        public const int DefaultChunkSize = 1 << 20;         // 1 MB

        public FdbDocumentCollection(ISubspaceLocation subspace, Func <TDocument, TId> selector, IValueEncoder <TDocument> valueEncoder)
            : this(subspace.AsTyped <TId, int>(), selector, valueEncoder)
        {
        }
        /// <summary>Create an allocator operating under a specific location</summary>
        public FdbHighContentionAllocator(ISubspaceLocation location)
        {
            Contract.NotNull(location);

            this.Location = location.AsTyped <int, long>();
        }
        // Inspired by https://apple.github.io/foundationdb/multimaps.html
        // It is the logical equivalent of a Map<KeyValuePair<TKey, TValue>, long> where the value would be incremented each time a specific pair of (key, value) is added (and subtracted when removed)

        // The layer stores each key/value using the following format:
        // (..., key, value) = 64-bit counter

        /// <summary>Create a new multimap</summary>
        /// <param name="subspace">Location where the map will be stored in the database</param>
        /// <param name="allowNegativeValues">If true, allow negative or zero values to stay in the map.</param>
        public FdbMultiMap(ISubspaceLocation subspace, bool allowNegativeValues)
            : this(subspace.AsTyped <TKey, TValue>(), allowNegativeValues)
        {
        }
Exemplo n.º 4
0
 public FdbMap(ISubspaceLocation location, IValueEncoder <TValue> valueEncoder)
     : this(location.AsTyped <TKey>(), valueEncoder)
 {
 }
 /// <summary>Create a new queue using either High Contention mode or Simple mode</summary>
 /// <param name="location">Subspace where the queue will be stored</param>
 /// <param name="encoder">Encoder for the values stored in this queue</param>
 /// <remarks>Uses the default Tuple serializer</remarks>
 public FdbQueue(ISubspaceLocation location, IValueEncoder <T>?encoder = null)
     : this(location.AsTyped <VersionStamp>(), encoder)
 {
 }
Exemplo n.º 6
0
 public FdbIndex(ISubspaceLocation path, IEqualityComparer <TValue>?valueComparer = null, bool indexNullValues = false)
     : this(path.AsTyped <TValue, TId>(), valueComparer, indexNullValues)
 {
 }