public static async ValueTask <TValue?> TryGetValueAsync <TKey, TValue>(this IBytesStorage <TKey> bytesStorage, TKey key, CancellationToken cancellationToken = default)
            where TKey : notnull, IEquatable <TKey>
            where TValue : IRocketPackObject <TValue>
        {
            var bytesPool = BytesPool.Shared;

            using var hub = new BytesHub(bytesPool);

            if (!await bytesStorage.TryReadAsync(key, hub.Writer, cancellationToken))
            {
                return(default);
        public static async IAsyncEnumerable <TValue> GetValuesAsync <TKey, TValue>(this IBytesStorage <TKey> bytesStorage, [EnumeratorCancellation] CancellationToken cancellationToken = default)
            where TKey : notnull, IEquatable <TKey>
            where TValue : IRocketPackObject <TValue>
        {
            var bytesPool = BytesPool.Shared;

            using var hub = new BytesHub(bytesPool);

            await foreach (var key in bytesStorage.GetKeysAsync(cancellationToken))
            {
                if (!await bytesStorage.TryReadAsync(key, hub.Writer, cancellationToken))
                {
                    continue;
                }

                var value = IRocketPackObject <TValue> .Import(hub.Reader.GetSequence(), bytesPool);

                yield return(value);

                hub.Reset();
            }
        }