Beispiel #1
0
        internal override unsafe Task <long> RemoveChunk(long mapId, long key, long version, Lookup direction)
        {
            var ret = base.RemoveChunk(mapId, key, version, direction);

            var extSid = this.GetExtendedSeriesId(mapId);
            var header = new MessageHeader {
                UUID        = new UUID(extSid.UUID),
                MessageType = MessageType.RemoveChunk,
                Version     = version
            };
            var commandBody = new ChunkCommandBody {
                ChunkKey = key,
                Lookup   = (int)direction
            };
            var         len = MessageHeader.Size + ChunkCommandBody.Size;
            BufferClaim claim;

            _appendLog.Claim(len, out claim);
            *(MessageHeader *)(claim.Data) = header;
            TypeHelper <ChunkCommandBody> .StructureToPtr(commandBody, claim.Data + MessageHeader.Size);

            claim.ReservedValue = Pid;
            claim.Commit();

            return(ret);
        }
Beispiel #2
0
        internal override unsafe Task <long> SaveChunk(SeriesChunk chunk)
        {
            var ret = base.SaveChunk(chunk);

            var extSid = this.GetExtendedSeriesId(chunk.Id);
            var header = new MessageHeader {
                UUID        = new UUID(extSid.UUID),
                MessageType = MessageType.SetChunk,
                Version     = chunk.Version
            };
            var commandBody = new ChunkCommandBody {
                ChunkKey = chunk.ChunkKey,
                Count    = chunk.Count,
            };
            var len = MessageHeader.Size + ChunkCommandBody.Size;


            BufferClaim claim;

            _appendLog.Claim(len, out claim);
            *(MessageHeader *)(claim.Data) = header;
            TypeHelper <ChunkCommandBody> .StructureToPtr(commandBody, claim.Data + MessageHeader.Size);

            claim.ReservedValue = Pid;
            claim.Commit();

            return(ret);
        }