Example #1
0
        /// <summary>
        /// Adds a key-value pair
        /// </summary>
        /// <param name="Key"></param>
        /// <param name="AWValue"></param>
        public void Add(Record Key, Record Value)
        {
            // Step the version //
            this._Version++;

            // Check that everything's ok //
            if (Key.Count != this._KeyFields.Count || Value.Count != this._ValueFields.Count)
            {
                throw new ArgumentException("Key or value passed is/are invalid");
            }

            Record r = Record.Join(Key, Value);

            this.Insert(r);
        }
Example #2
0
        /// <summary>
        /// Sets a value
        /// </summary>
        /// <param name="Key"></param>
        /// <param name="AWValue"></param>
        public void SetValue(Record Key, Record Value)
        {
            // Step the version //
            this._Version++;

            // Get the final record value //
            Record r = Record.Join(Key, Value);

            // If exists, then update, otherwise add
            RecordKey ptr = this._Cluster.FindFirstKey(Key, true);

            if (ptr.IsNotFound)
            {
                this.Insert(r);
            }
            else
            {
                this._Cluster.Update(ptr, r);
            }
        }