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

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

public setValue ( RecordKey key, RecordUpdate update ) : void
key RecordKey
update RecordUpdate
Результат void
        public void setValue(RecordKey key, RecordUpdate update)
        {
            // build a byte[] for the updates using the basic block encoder
            MemoryStream writer = new MemoryStream();
            // TODO: this seems like a really inefficient way to write out a key
            ISegmentBlockEncoder encoder = new SegmentBlockBasicEncoder();
            encoder.setStream(writer);
            encoder.add(key, update);
            encoder.flush();
            writer.Flush();
            this.addCommand((byte)LogCommands.UPDATE, writer.ToArray());

            // Writes are actually applied to the workingSegment when the LgoWriter pushes them to the ILogReceiver.
            // This assures, for example, that DISK_ATOMIC writes to not apply to the segments until the writegroup is flushed.
        }

Usage Example

Пример #1
0
        // move the pending address into the freelist
        private void handleRegionSafeToFree(long start_addr, FreespaceExtent extent, LayerWriteGroup wg)
        {
            System.Console.WriteLine("*\n*\n*\n* handleRegionSafeToFree {0} \n*\n*\n*", start_addr);
            // (1) remove pending entry
            wg.setValue(pendingKeyForAddr(start_addr), RecordUpdate.DeletionTombstone());

            // (2) write real freelist entry (TODO: merge with neighboring entries)
            {
                RecordKey key = new RecordKey().appendParsedKey(".ROOT/FREELIST/EXTENTS");
                key.appendKeyPart(new RecordKeyType_Long(extent.end_addr));
                wg.setValue(key, RecordUpdate.WithPayload(extent.pack()));
            }
            wg.finish();
        }
All Usage Examples Of Bend.LayerWriteGroup::setValue