/// <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="subspace">Subspace to be used for storing the blob data and metadata</param>
        public FdbBlob([NotNull] IFdbSubspace subspace)
        {
            if (subspace == null)
            {
                throw new ArgumentNullException("subspace");
            }

            this.Subspace = subspace.Using(TypeSystem.Tuples);
        }
        public FdbHashSetCollection(IFdbSubspace subspace)
        {
            if (subspace == null)
            {
                throw new ArgumentNullException(nameof(subspace));
            }

            this.Subspace = subspace.Using(TypeSystem.Tuples);
        }
Beispiel #3
0
        public FdbVector([NotNull] IFdbSubspace subspace, T defaultValue, [NotNull] IValueEncoder <T> encoder)
        {
            if (subspace == null)
            {
                throw new ArgumentNullException("subspace");
            }
            if (encoder == null)
            {
                throw new ArgumentNullException("encoder");
            }

            this.Subspace     = subspace.Using(TypeSystem.Tuples);
            this.DefaultValue = defaultValue;
            this.Encoder      = encoder;
        }
Beispiel #4
0
        public FdbWorkerPool(IFdbSubspace subspace)
        {
            if (subspace == null)
            {
                throw new ArgumentNullException(nameof(subspace));
            }

            this.Subspace = subspace.Using(TypeSystem.Tuples);

            this.TaskStore          = this.Subspace.Partition.ByKey(Slice.FromChar('T'));
            this.IdleRing           = this.Subspace.Partition.ByKey(Slice.FromChar('I'));
            this.BusyRing           = this.Subspace.Partition.ByKey(Slice.FromChar('B'));
            this.UnassignedTaskRing = this.Subspace.Partition.ByKey(Slice.FromChar('U'));

            this.Counters = new FdbCounterMap <int>(this.Subspace.Partition.ByKey(Slice.FromChar('C')));
        }
        /// <summary>Create a new High Contention counter, using a specific value encoder.</summary>
        /// <param name="db">Database used by this layer</param>
        /// <param name="subspace">Subspace to be used for storing the counter</param>
        /// <param name="encoder">Encoder for the counter values</param>
        public FdbHighContentionCounter([NotNull] IFdbDatabase db, [NotNull] IFdbSubspace subspace, [NotNull] IValueEncoder <long> encoder)
        {
            if (db == null)
            {
                throw new ArgumentNullException("db");
            }
            if (subspace == null)
            {
                throw new ArgumentNullException("subspace");
            }
            if (encoder == null)
            {
                throw new ArgumentNullException("encoder");
            }

            this.Database = db;
            this.Subspace = subspace.Using(TypeSystem.Tuples);
            this.Encoder  = encoder;
        }
        /// <summary>Create a new queue using either High Contention mode or Simple mode</summary>
        /// <param name="subspace">Subspace where the queue will be stored</param>
        /// <param name="highContention">If true, uses High Contention Mode (lots of popping clients). If true, uses the Simple Mode (a few popping clients).</param>
        public FdbQueue([NotNull] IFdbSubspace subspace, bool highContention, [NotNull] IValueEncoder <T> encoder)
        {
            if (subspace == null)
            {
                throw new ArgumentNullException("subspace");
            }
            if (encoder == null)
            {
                throw new ArgumentNullException("encoder");
            }

            this.Subspace       = subspace.Using(TypeSystem.Tuples);
            this.HighContention = highContention;
            this.Encoder        = encoder;

            //TODO: rewrite this, using FdbEncoderSubpsace<..> !
            this.ConflictedPop  = this.Subspace.Partition.ByKey(Slice.FromAscii("pop"));
            this.ConflictedItem = this.Subspace.Partition.ByKey(Slice.FromAscii("conflict"));
            this.QueueItem      = this.Subspace.Partition.ByKey(Slice.FromAscii("item"));
        }
		public FdbHashSetCollection(IFdbSubspace subspace)
		{
			if (subspace == null) throw new ArgumentNullException("subspace");

			this.Subspace = subspace.Using(TypeSystem.Tuples);
		}
		public FdbWorkerPool(IFdbSubspace subspace)
		{
			if (subspace == null) throw new ArgumentNullException("subspace");

			this.Subspace = subspace.Using(TypeSystem.Tuples);

			this.TaskStore = this.Subspace.Partition.ByKey(Slice.FromChar('T'));
			this.IdleRing = this.Subspace.Partition.ByKey(Slice.FromChar('I'));
			this.BusyRing = this.Subspace.Partition.ByKey(Slice.FromChar('B'));
			this.UnassignedTaskRing = this.Subspace.Partition.ByKey(Slice.FromChar('U'));

			this.Counters = new FdbCounterMap<int>(this.Subspace.Partition.ByKey(Slice.FromChar('C')));
		}
		public static FdbDirectoryLayer Create(IFdbSubspace subspace, IEnumerable<string> path = null)
		{
			if (subspace == null) throw new ArgumentNullException("subspace");

			var location = path != null ? ParsePath(path) : FdbTuple.Empty;
			var space = subspace.Using(TypeSystem.Tuples);
			return new FdbDirectoryLayer(space.Partition[FdbKey.Directory], space, location);
		}