Documentation
¶
Index ¶
- type Option
- type Store
- func (s *Store) Delete(ctx context.Context, key string) error
- func (s *Store) DeletePrefix(ctx context.Context, prefix string) error
- func (s *Store) Exists(ctx context.Context, key string) (bool, error)
- func (s *Store) Flush(ctx context.Context) error
- func (s *Store) Get(ctx context.Context, key string) ([]byte, error)
- func (s *Store) GetRange(ctx context.Context, key string, offset, length int64) ([]byte, error)
- func (s *Store) List(ctx context.Context, prefix string) ([]string, error)
- func (s *Store) NewWriter(ctx context.Context, key string) io.WriteCloser
- func (s *Store) Put(ctx context.Context, key string, data []byte) error
- func (s *Store) SignedURL(ctx context.Context, key string, validFor time.Duration) (string, error)
- func (s *Store) Size(ctx context.Context, key string) (int64, error)
- func (s *Store) TotalSize(ctx context.Context) (int64, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Option ¶
type Option func(*b2Options)
Option configures a B2 store.
func WithClient ¶
WithClient provides a pre-configured B2 client, skipping internal client creation. When set, WithCredentials is ignored.
func WithCredentials ¶
WithCredentials sets the Backblaze application key ID and key used to authenticate. Ignored when WithClient is provided.
func WithPrefix ¶
WithPrefix sets a key prefix prepended to every object key. Use this to isolate multiple repositories within a single bucket (e.g. "prod/" and "staging/").
type Store ¶
type Store struct {
// contains filtered or unexported fields
}
Store implements store.ObjectStore for Backblaze B2.
func New ¶
New creates a Store for the given bucket. Either WithCredentials or WithClient must be provided.
func (*Store) DeletePrefix ¶
DeletePrefix deletes all objects under the given prefix.
func (*Store) GetRange ¶
GetRange implements RangeGetter using a B2 ranged download, so a caller reading a packfile footer transfers a few hundred bytes rather than the whole object.
func (*Store) NewWriter ¶
NewWriter returns a streaming writer to the given key in B2. The caller must Close the writer to finalize the upload.