Exemple #1
0
        public AbstractBufferedWriter PrepareToWriteObject(ulong id)
        {
            var shouldStop = false;

            try
            {
                _keyValueTrProtector.Start(ref shouldStop);
                _keyValueTr.SetKeyPrefix(ObjectDB.AllObjectsPrefix);
                var key = new byte[PackUnpack.LengthVUInt(id)];
                var ofs = 0;
                PackUnpack.PackVUInt(key, ref ofs, id);
                _keyValueTr.CreateKey(key);
                var writer = new KeyValueDBValueProtectedWriter(_keyValueTr, _keyValueTrProtector);
                shouldStop = false;
                return(writer);
            }
            finally
            {
                if (shouldStop)
                {
                    _keyValueTrProtector.Stop();
                }
            }
        }
 public override void Dispose()
 {
     base.Dispose();
     _protector.Stop();
 }