ownwrites

package
v0.17.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 16, 2024 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Overview

Package ownwrites defines a blob.Storage wrapper that ensures that recently-written blobs show up in ListBlob() results, if the underlying provider is eventually consistent when it comes to list results.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewWrapper

func NewWrapper(st, cacheStorage blob.Storage, prefixes []blob.ID, cacheDuration time.Duration) blob.Storage

NewWrapper returns new wrapper that ensures list consistency with local writes for the given set of blob prefixes. It leverages the provided local cache storage to maintain markers keeping track of recently created and deleted blobs.

Types

type CacheStorage

type CacheStorage struct {
	blob.Storage
	// contains filtered or unexported fields
}

CacheStorage implements a wrapper around blob.Storage that ensures recent local mutations are reflected in ListBlobs() results.

func (*CacheStorage) DeleteBlob

func (s *CacheStorage) DeleteBlob(ctx context.Context, blobID blob.ID) error

DeleteBlob implements blob.Storage and writes markers into local cache for all successful deletes.

func (*CacheStorage) ListBlobs

func (s *CacheStorage) ListBlobs(ctx context.Context, prefix blob.ID, cb func(blob.Metadata) error) error

ListBlobs implements blob.Storage and merges provider-returned results with cached ones.

func (*CacheStorage) PutBlob

func (s *CacheStorage) PutBlob(ctx context.Context, blobID blob.ID, data blob.Bytes, opts blob.PutOptions) error

PutBlob implements blob.Storage and writes markers into local cache for all successful writes.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL