Пример #1
0
        public override void PutOwnerVal(KadValue value)
        {
            Put(value);

            lock ( _ownerValIds ) {
                _ownerValIds.Add(value.Id);
            }
        }
Пример #2
0
        public static byte[] ToBytes(KadValue value)
        {
            MemoryStream memStream = new MemoryStream(value.Id.Value.Length + value.Value.Length);

            memStream.Write(value.Id.Value, 0, value.Id.Value.Length);
            memStream.Write(value.Value, 0, value.Value.Length);

            return(memStream.ToArray());
        }
Пример #3
0
        public override void Put(KadValue value)
        {
            if (IsFull())
            {
                throw new Exception("Storage is full");
            }

            if (value == null)
            {
                throw new ArgumentNullException("value");
            }

            if (Contains(value.Id))
            {
                throw new Exception($"Already exists value with a key {value.Id}");
            }

            _data.AddOrUpdate(value.Id, value, (k, v) => v);
        }
Пример #4
0
 public abstract void PutOwnerVal(KadValue value);
Пример #5
0
 public abstract void Put(KadValue value);