コード例 #1
0
 private Event CreateStreamMetadataEvent()
 {
     var eventId = Guid.NewGuid();
     var acl = new StreamAcl(
         readRole: SystemRoles.Admins, writeRole: SystemRoles.Admins,
         deleteRole: SystemRoles.Admins, metaReadRole: SystemRoles.All,
         metaWriteRole: SystemRoles.Admins);
     var metadata = new StreamMetadata(maxCount: 2, maxAge: null, cacheControl: null, acl: acl);
     var dataBytes = metadata.ToJsonBytes();
     return new Event(eventId, SystemEventTypes.StreamMetadata, isJson: true, data: dataBytes, metadata: null);
 }
コード例 #2
0
 private Event CreateStreamMetadataEvent(int? tb)
 {
     var eventId = Guid.NewGuid();
     var acl = new StreamAcl(
         readRole: SystemRoles.Admins, writeRole: SystemRoles.Admins,
         deleteRole: SystemRoles.Admins, metaReadRole: SystemRoles.Admins,
         metaWriteRole: SystemRoles.Admins);
     var metadata = new StreamMetadata(cacheControl: null, 
                                       truncateBefore: tb, 
                                       acl: acl);
     var dataBytes = metadata.ToJsonBytes();
     return new Event(eventId, SystemEventTypes.StreamMetadata, isJson: true, data: dataBytes, metadata: null);
 }
コード例 #3
0
            public ReadAllEventsBackwardCompleted(Guid correlationId, ReadAllResult result, string error, ResolvedEvent[] events, 
                                                  StreamMetadata streamMetadata, bool isCachePublic, int maxCount,
                                                  TFPos currentPos, TFPos nextPos, TFPos prevPos, long tfLastCommitPosition)
            {
                Ensure.NotNull(events, "events");

                CorrelationId = correlationId;
                Result = result;
                Error = error;
                Events = events;
                StreamMetadata = streamMetadata;
                IsCachePublic = isCachePublic;
                MaxCount = maxCount;
                CurrentPos = currentPos;
                NextPos = nextPos;
                PrevPos = prevPos;
                TfLastCommitPosition = tfLastCommitPosition;
            }
コード例 #4
0
            public ReadStreamEventsBackwardCompleted(Guid correlationId,
                                                     string eventStreamId,
                                                     int fromEventNumber,
                                                     int maxCount,
                                                     ReadStreamResult result,
                                                     ResolvedEvent[] events,
                                                     StreamMetadata streamMetadata,
                                                     bool isCachePublic,
                                                     string error,
                                                     int nextEventNumber,
                                                     int lastEventNumber,
                                                     bool isEndOfStream,
                                                     long tfLastCommitPosition)
            {
                Ensure.NotNull(events, "events");

                if (result != ReadStreamResult.Success)
                {
                    Ensure.Equal(nextEventNumber, -1, "nextEventNumber");
                    Ensure.Equal(isEndOfStream, true, "isEndOfStream");
                }

                CorrelationId = correlationId;
                EventStreamId = eventStreamId;
                FromEventNumber = fromEventNumber;
                MaxCount = maxCount;

                Result = result;
                Events = events;
                StreamMetadata = streamMetadata;
                IsCachePublic = isCachePublic;
                Error = error;
                NextEventNumber = nextEventNumber;
                LastEventNumber = lastEventNumber;
                IsEndOfStream = isEndOfStream;
                TfLastCommitPosition = tfLastCommitPosition;
            }
コード例 #5
0
            public ReadEventCompleted(Guid correlationId, string eventStreamId, ReadEventResult result,
                                      ResolvedEvent record, StreamMetadata streamMetadata, bool isCachePublic, string error)
            {
                Ensure.NotNullOrEmpty(eventStreamId, "eventStreamId");
                if (result == ReadEventResult.Success)
                    Ensure.NotNull(record.Event, "record.Event");

                CorrelationId = correlationId;
                EventStreamId = eventStreamId;
                Result = result;
                Record = record;
                StreamMetadata = streamMetadata;
                IsCachePublic = isCachePublic;
                Error = error;
            }
コード例 #6
0
ファイル: Configure.cs プロジェクト: adbrowne/EventStore
 private static int? GetCacheSeconds(StreamMetadata metadata)
 {
     return metadata != null && metadata.CacheControl.HasValue
                    ? (int) metadata.CacheControl.Value.TotalSeconds
                    : (int?) null;
 }
コード例 #7
0
 public static Rec Prepare(int transaction, string stream, string eventType = null, DateTime? timestamp = null, StreamMetadata metadata = null)
 {
     return new Rec(RecType.Prepare, transaction, stream, eventType, timestamp, metadata);
 }
コード例 #8
0
        public Rec(RecType type, int transaction, string streamId, string eventType, DateTime? timestamp, StreamMetadata metadata = null)
        {
            Ensure.NotNullOrEmpty(streamId, "streamId");
            Ensure.Nonnegative(transaction, "transaction");

            Type = type;
            Id = Guid.NewGuid();
            Transaction = transaction;
            StreamId = streamId;
            EventType = eventType ?? string.Empty;
            TimeStamp = timestamp ?? DateTime.UtcNow;
            Metadata = metadata;
        }
コード例 #9
0
ファイル: Configure.cs プロジェクト: jjvdangelo/EventStore
        private static bool IsCachePublic(string streamId, StreamMetadata metadata)
        {
            if (SystemStreams.IsMetastream(streamId))
                return false; // we don't have enough info here for metastreams

            var isSystem = SystemStreams.IsSystemStream(streamId);
            var role = (metadata == null || metadata.Acl == null) ? null : metadata.Acl.ReadRole;
            return isSystem ? (role == SystemUserGroups.All) : (role == null || role == SystemUserGroups.All);
        }