Пример #1
0
        // in v2 this checks if the first character is '$'
        // system streams can be created dynamically at runtime
        // e.g. "$persistentsubscription-" + _eventStreamId + "::" + _groupName + "-parked"
        // so we can either allocate a range of numbers (how many?) for them, or look up the name and see if it begins with $.
        // for now do the latter because (1) allocating a range of numbers will probably get fiddly
        // and (2) i expect we will find that at the point we are trying to determine if a stream is a system stream then
        // we will have already looked up its info in the stream index, so this call will become trivial or unnecessary.
        public bool IsSystemStream(long streamId)
        {
            if (IsVirtualStream(streamId) ||
                _metastreams.IsMetaStream(streamId))
            {
                return(true);
            }

            var streamName = _streamNames.LookupName(streamId);

            return(SystemStreams.IsSystemStream(streamName));
        }
Пример #2
0
 public long GetStreamLastEventNumber(TStreamId streamId)
 {
     if (_metastreams.IsMetaStream(streamId))
     {
         return(GetStreamLastEventNumber(_metastreams.OriginalStreamOf(streamId)));
     }
     return(_isStreamDeleted(streamId) ? EventNumber.DeletedStream : 1000000);
 }
Пример #3
0
        // in v2 this checks if the first character is '$'
        // system streams can be created dynamically at runtime
        // e.g. "$persistentsubscription-" + _eventStreamId + "::" + _groupName + "-parked"
        // so we can either allocate a range of numbers (how many?) for them, or look up the name and see if it begins with $.
        // for now do the latter because (1) allocating a range of numbers will probably get fiddly
        // and (2) i expect we will find that at the point we are trying to determine if a stream is a system stream then
        // we will have already looked up its info in the stream index, so this call will become trivial or unnecessary.
        public bool IsSystemStream(StreamId streamId)
        {
            if (IsVirtualStream(streamId) ||
                _metastreams.IsMetaStream(streamId) ||
                streamId == NoSystemStream)
            {
                return(true);
            }

            if (streamId == NoUserStream)
            {
                return(false);
            }

            var streamName = _streamNames.LookupName(streamId);

            return(SystemStreams.IsSystemStream(streamName));
        }
Пример #4
0
        public string LookupName(long streamId)
        {
            string name;

            if (_metastreams.IsMetaStream(streamId))
            {
                streamId = _metastreams.OriginalStreamOf(streamId);
                name     = LookupName(streamId);
                name     = SystemStreams.MetastreamOf(name);
                return(name);
            }

            if (LogV3SystemStreams.TryGetVirtualStreamName(streamId, out name))
            {
                return(name);
            }

            name = _wrapped.LookupName(streamId);
            return(name);
        }
        public bool TryGetName(StreamId streamId, out string name)
        {
            if (_metastreams.IsMetaStream(streamId))
            {
                streamId = _metastreams.OriginalStreamOf(streamId);
                if (!TryGetName(streamId, out name))
                {
                    return(false);
                }
                name = SystemStreams.MetastreamOf(name);
                return(true);
            }

            if (LogV3SystemStreams.TryGetVirtualStreamName(streamId, out name))
            {
                return(true);
            }

            return(_wrapped.TryGetName(streamId, out name));
        }