Beispiel #1
0
        private unsafe void LogReleaseLock(UUID uuid)
        {
            var header = new CommandHeader {
                SeriesId    = uuid,
                CommandType = CommandType.ReleaseLock,
            };
            var         len = CommandHeader.Size;
            BufferClaim claim;

            _appendLog.Claim(len, out claim);
            *(CommandHeader *)(claim.Data) = header;
            claim.ReservedValue            = Pid;
            claim.Commit();
        }
Beispiel #2
0
        private unsafe void LogHeaderOnly(CommandType type)
        {
            var header = new CommandHeader {
                SeriesId    = _uuid,
                CommandType = type,
                Version     = this.Version
            };
            var         len = CommandHeader.Size;
            BufferClaim claim;

            _appendLog.Claim(len, out claim);
            *(CommandHeader *)(claim.Data) = header;
            claim.ReservedValue            = _pid;
            claim.Commit();
        }
Beispiel #3
0
        private unsafe void LogAcquireLock(UUID uuid, long version)
        {
            var header = new CommandHeader {
                SeriesId    = uuid,
                CommandType = CommandType.AcquireLock,
                Version     = version
            };
            var         len = CommandHeader.Size;
            BufferClaim claim;

            _appendLog.Claim(len, out claim);
            *(CommandHeader *)(claim.Data) = header;
            claim.ReservedValue            = Pid;
            claim.Commit();
        }
Beispiel #4
0
        public unsafe void Broadcast(DirectBuffer buffer, UUID correlationId = default(UUID), long version = 0L)
        {
            var header = new CommandHeader {
                SeriesId    = correlationId,
                CommandType = CommandType.Broadcast,
                Version     = version
            };

            var         len = CommandHeader.Size + (int)buffer.Length;
            BufferClaim claim;

            _appendLog.Claim(len, out claim);
            *(CommandHeader *)(claim.Data) = header;
            claim.Buffer.WriteBytes(claim.Offset + CommandHeader.Size, buffer, 0, buffer.Length);
            claim.ReservedValue = Pid;
            claim.Commit();
        }
Beispiel #5
0
        private unsafe void LogSubscribe(UUID uuid, long version, string extendedTextId)
        {
            var header = new CommandHeader {
                SeriesId    = uuid,
                CommandType = CommandType.Subscribe,
                Version     = version
            };

            var textIdBytes = Encoding.UTF8.GetBytes(extendedTextId);

            var         len = CommandHeader.Size + textIdBytes.Length;
            BufferClaim claim;

            _appendLog.Claim(len, out claim);
            *(CommandHeader *)(claim.Data) = header;
            claim.Buffer.WriteBytes(claim.Offset + CommandHeader.Size, textIdBytes, 0, textIdBytes.Length);
            claim.ReservedValue = Pid;
            claim.Commit();
        }