Пример #1
0
        public StreamId LookupValue(string streamName)
        {
            if (string.IsNullOrEmpty(streamName))
            {
                throw new ArgumentNullException(nameof(streamName));
            }

            StreamId streamId;

            if (SystemStreams.IsMetastream(streamName))
            {
                streamName = SystemStreams.OriginalStreamOf(streamName);
                streamId   = LookupValue(streamName);
                return(_metastreams.MetaStreamOf(streamId));
            }

            if (LogV3SystemStreams.TryGetVirtualStreamId(streamName, out streamId))
            {
                return(streamId);
            }

            var result = _wrapped.LookupValue(streamName);

            return(result == default
                                ? SystemStreams.IsSystemStream(streamName)
                                        ? LogV3SystemStreams.NoSystemStream
                                        : LogV3SystemStreams.NoUserStream
                                : result);
        }
        public long LookupId(string streamName)
        {
            long streamId;

            if (SystemStreams.IsMetastream(streamName))
            {
                streamName = SystemStreams.OriginalStreamOf(streamName);
                streamId   = LookupId(streamName);
                return(_metastreams.MetaStreamOf(streamId));
            }

            if (LogV3SystemStreams.TryGetVirtualStreamId(streamName, out streamId))
            {
                return(streamId);
            }

            return(_wrapped.LookupId(streamName));
        }
Пример #3
0
        public bool GetOrAddId(string streamName, out long streamId, out long createdId, out string createdName)
        {
            if (SystemStreams.IsMetastream(streamName))
            {
                streamName = SystemStreams.OriginalStreamOf(streamName);
                var ret = GetOrAddId(streamName, out streamId, out createdId, out createdName);
                streamId = _metastreams.MetaStreamOf(streamId);
                return(ret);
            }

            if (LogV3SystemStreams.TryGetVirtualStreamId(streamName, out streamId))
            {
                createdId   = default;
                createdName = default;
                return(true);
            }

            return(_wrapped.GetOrAddId(streamName, out streamId, out createdId, out createdName));
        }
Пример #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);
        }
Пример #5
0
        public bool GetOrReserve(string streamName, out StreamId streamId, out StreamId createdId, out string createdName)
        {
            Ensure.NotNullOrEmpty(streamName, "streamName");
            if (SystemStreams.IsMetastream(streamName))
            {
                streamName = SystemStreams.OriginalStreamOf(streamName);
                var ret = GetOrReserve(streamName, out streamId, out createdId, out createdName);
                streamId = _metastreams.MetaStreamOf(streamId);
                return(ret);
            }

            if (LogV3SystemStreams.TryGetVirtualStreamId(streamName, out streamId))
            {
                createdId   = default;
                createdName = default;
                return(true);
            }

            return(_wrapped.GetOrReserve(streamName, out streamId, out createdId, out createdName));
        }
        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));
        }
Пример #7
0
        public long LookupId(string streamName)
        {
            long streamId;

            if (SystemStreams.IsMetastream(streamName))
            {
                streamName = SystemStreams.OriginalStreamOf(streamName);
                streamId   = LookupId(streamName);
                return(_metastreams.MetaStreamOf(streamId));
            }

            if (LogV3SystemStreams.TryGetVirtualStreamId(streamName, out streamId))
            {
                return(streamId);
            }

            var result = _wrapped.LookupId(streamName);

            return(result == default
                                ? SystemStreams.IsSystemStream(streamName)
                                        ? LogV3SystemStreams.NoSystemStream
                                        : LogV3SystemStreams.NoUserStream
                                : result);
        }