/// <summary>Create a new counter map, using a specific key encoder.</summary>
        public FdbCounterMap([NotNull] IFdbSubspace subspace, [NotNull] IKeyEncoder <TKey> keyEncoder)
        {
            if (subspace == null)
            {
                throw new ArgumentNullException("subspace");
            }
            if (keyEncoder == null)
            {
                throw new ArgumentNullException("keyEncoder");
            }

            this.Subspace   = subspace;
            this.KeyEncoder = keyEncoder;
            this.Location   = subspace.UsingEncoder(keyEncoder);
        }
Esempio n. 2
0
        /// <summary>Create a new multimap, using a specific key and value encoder</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>
        /// <param name="encoder">Encoder for the key/value pairs</param>
        public FdbMultiMap(IFdbSubspace subspace, bool allowNegativeValues, ICompositeKeyEncoder <TKey, TValue> encoder)
        {
            if (subspace == null)
            {
                throw new ArgumentNullException("subspace");
            }
            if (encoder == null)
            {
                throw new ArgumentNullException("encoder");
            }

            this.Subspace            = subspace;
            this.AllowNegativeValues = allowNegativeValues;
            this.Location            = subspace.UsingEncoder(encoder);
        }
        public FdbIndex([NotNull] string name, [NotNull] IFdbSubspace subspace, IEqualityComparer <TValue> valueComparer, bool indexNullValues, [NotNull] ICompositeKeyEncoder <TValue, TId> encoder)
        {
            if (name == null)
            {
                throw new ArgumentNullException("name");
            }
            if (subspace == null)
            {
                throw new ArgumentNullException("subspace");
            }
            if (encoder == null)
            {
                throw new ArgumentNullException("encoder");
            }

            this.Name            = name;
            this.Subspace        = subspace;
            this.ValueComparer   = valueComparer ?? EqualityComparer <TValue> .Default;
            this.IndexNullValues = indexNullValues;
            this.Location        = subspace.UsingEncoder(encoder);
        }
        public FdbMap([NotNull] string name, [NotNull] IFdbSubspace subspace, [NotNull] IKeyEncoder <TKey> keyEncoder, [NotNull] IValueEncoder <TValue> valueEncoder)
        {
            if (name == null)
            {
                throw new ArgumentNullException("name");
            }
            if (subspace == null)
            {
                throw new ArgumentNullException("subspace");
            }
            if (keyEncoder == null)
            {
                throw new ArgumentNullException("keyEncoder");
            }
            if (valueEncoder == null)
            {
                throw new ArgumentNullException("valueEncoder");
            }

            this.Name         = name;
            this.Subspace     = subspace;
            this.Location     = subspace.UsingEncoder(keyEncoder);
            this.ValueEncoder = valueEncoder;
        }