Beispiel #1
0
        public EventAppendStatus AppendStream(EventStream stream)
        {
            lock (_lockObj)
            {
                var record = new StreamLogRecord(_ipAddress, _port)
                {
                    SourceId  = stream.SourceId,
                    Name      = stream.Name,
                    Version   = stream.Version,
                    Events    = stream.Events,
                    CommandId = stream.CommandId,
                    Timestamp = stream.Timestamp,
                    Items     = stream.Items
                };
                _chunkWriter.Write(record);

                var dict = _commandDict.GetOrAdd(stream.SourceId, x => new ConcurrentDictionary <string, byte>());
                if (!dict.TryAdd(stream.CommandId, 1))
                {
                    return(EventAppendStatus.DuplicateCommand);
                }

                //TODO
                return(EventAppendStatus.Success);
            }
        }
Beispiel #2
0
 public EventAppendStatus AppendStream(EventStream stream)
 {
     lock (_lockObj)
     {
         var record = new StreamLogRecord(_ipAddress, _port)
         {
             SourceId  = stream.SourceId,
             Name      = stream.Name,
             Version   = stream.Version,
             Events    = stream.Events,
             CommandId = stream.CommandId,
             Timestamp = stream.Timestamp,
             Items     = stream.Items
         };
         _chunkWriter.Write(record);
         return(EventAppendStatus.Success);
     }
 }