public bool TryGetName(StreamId streamId, out string name) { if (streamId % 2 == 1) { throw new ArgumentOutOfRangeException(nameof(streamId), "streamId must be even"); } // we divided by two when calculating the position in the stream, since we dont // explicitly create metastreams. var record = _indexReader.ReadPrepare( streamId: LogV3SystemStreams.StreamsCreatedStreamNumber, eventNumber: StreamIdConverter.ToEventNumber(streamId)); if (record is null) { name = null; return(false); } if (record is not LogV3StreamRecord streamRecord) { throw new Exception($"Unexpected log record type: {record}."); } name = streamRecord.StreamName; return(true); }
public bool TryGetName(uint eventTypeId, out string name) { var record = _indexReader.ReadPrepare( streamId: LogV3SystemStreams.EventTypesStreamNumber, eventNumber: EventTypeIdConverter.ToEventNumber(eventTypeId)); if (record is null) { name = null; return(false); } if (record is not LogV3EventTypeRecord eventTypeRecord) { throw new Exception($"Unexpected log record type: {record}."); } name = eventTypeRecord.EventTypeName; return(true); }