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

public setValue ( RecordKey key, RecordUpdate update ) : void
key RecordKey
update RecordUpdate
Результат void
Пример #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();
        }
Пример #2
0
        public void mapSegment(LayerWriteGroup tx, int use_gen, 
            RecordKey start_key, RecordKey end_key, IRegion reader)
        {
            if (! (tx.type == LayerWriteGroup.WriteGroupType.DISK_ATOMIC_NOFLUSH ||
                   tx.type == LayerWriteGroup.WriteGroupType.DISK_ATOMIC_FLUSH)) {
                       throw new Exception("NewUnusedSegment.mapSegment() must be provided an ATOMIC write group");
            }

            // remove the pending entry
            RecordKey key = new RecordKey().appendParsedKey(".ROOT/FREELIST/PENDING");
            key.appendKeyPart(new RecordKeyType_Long(reader.getStartAddress()));
            tx.setValue(key, RecordUpdate.DeletionTombstone());

            // add the new map
            tx.mylayer.rangemapmgr.mapGenerationToRegion(tx, use_gen, start_key, end_key, reader);
        }
Пример #3
0
        public void freeSegment(LayerWriteGroup tx, FreespaceExtent segment_extent)
        {
            // (1) add the segment to the pending list (pending free)

            if (tx.type != LayerWriteGroup.WriteGroupType.DISK_ATOMIC_FLUSH) {
                throw new Exception("freeSegment() requires DISK_ATOMIC write group");
            }

            // NOTE: DISK_ATOMIC writes are not seen in the memory segment until the atomic write group applies
            //       so these changes will not be seen until then

            RecordKey key = new RecordKey().appendParsedKey(".ROOT/FREELIST/PENDING")
                .appendKeyPart(new RecordKeyType_Long(segment_extent.end_addr));

            RecordUpdate payload = RecordUpdate.WithPayload(segment_extent.pack());
            tx.setValue(key, payload);

            // (2) add a handler to get notified when the block is no longer referenced, so it can
            //     be moved from pending to actually free.

            LayerWriteGroup fwg = this.store.newWriteGroup(LayerWriteGroup.WriteGroupType.DISK_ATOMIC_NOFLUSH);

            // we don't want to ask for the notification until the write-group freeing this segment is finished
            tx.addCompletion(delegate() {
                tx.mylayer.regionmgr.notifyRegionSafeToFree(segment_extent.start_addr,
                    delegate(long addr) { this.handleRegionSafeToFree(addr, segment_extent, fwg); });
            });
        }