Bend.StepsStageSnapshot.setValue C# (CSharp) Метод

setValue() публичный Метод

public setValue ( RecordKey key, RecordUpdate update ) : void
key RecordKey
update RecordUpdate
Результат void
        public void setValue(RecordKey key, RecordUpdate update)
        {
            if (this.is_frozen) {
                throw new Exception("snapshot not writable! " + this.frozen_at_snapshotnumber);
            }
            // add our snapshot_number to the end of the keyspace
            key.appendKeyPart(new RecordKeyType_AttributeTimestamp(this.current_snapshot));
            // wrap the update into a sub-update, mostly because tombstones need to be "real" records
            // to us
            var sub_update = RecordUpdate.WithPayload(update.encode());
            next_stage.setValue(key, sub_update);
        }

Usage Example

Пример #1
0
        public void T000_TestBasic_SnapshotTombstones()
        {
            var raw_db = new LayerManager(InitMode.NEW_REGION, "c:\\BENDtst\\snapts");
            var snap_db = new StepsStageSnapshot(
               new StepsStageSubset(
                   new RecordKeyType_String("snapdb"),
                   raw_db));

            snap_db.setValue(new RecordKey().appendParsedKey("b/1"), RecordUpdate.DeletionTombstone());
            snap_db.setValue(new RecordKey().appendParsedKey("a/1"), RecordUpdate.WithPayload("data1"));

            var snapshot = snap_db.getSnapshot();

            snap_db.setValue(new RecordKey().appendParsedKey("a/1"), RecordUpdate.DeletionTombstone());

            raw_db.debugDump();

            int count = 0;
            foreach (var row in snap_db.scanForward(ScanRange<RecordKey>.All())) {
                Console.WriteLine("found record: " + row);
                count++;
            }
            Assert.AreEqual(0, count, "deletion tombstones didn't work in snapshot");
        }
All Usage Examples Of Bend.StepsStageSnapshot::setValue