zipstore

package
v0.4.1 Latest Latest
Warning

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

Go to latest
Published: Mar 15, 2024 License: Apache-2.0 Imports: 10 Imported by: 1

Documentation

Overview

Package zipstore implements a read-only view of the blob.Store interface using files stored in a ZIP archive.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Options

type Options struct {
	// Consider only files whose names have this prefix followed by a "/".
	//
	// As a special case, if Prefix == "" but all the entries in the archive
	// share a non-empty common prefix, that prefix is used.
	Prefix string
}

Options are optional settings for a Store. A nil *Options is ready for use and provides default values as described.

type Store

type Store struct {
	// contains filtered or unexported fields
}

A Store wraps a zip.Reader and serves its contents as a blob.Store. The contents of the archive must follow the same layout as a filestore.Store, with keys encoded as hexadecimal.

func New

func New(zf *zip.ReadCloser, opts *Options) Store

New constructs a Store from the given open zip.Reader. If opts == nil, default options are used as described by the Options type. The Store takes ownership of zf, and will close zf when the Store is closed.

func (Store) Close

func (s Store) Close(context.Context) error

Close implements a method of the blob.Store interface.

func (Store) Delete

func (s Store) Delete(_ context.Context, key string) error

Delete implements a method of the blob.Store interface. This implementation always reports an error, since the store is read-only.

func (Store) Get

func (s Store) Get(_ context.Context, key string) ([]byte, error)

Get implements a method of the blob.Store interface.

func (Store) Len

func (s Store) Len(ctx context.Context) (int64, error)

Len implements a method of the blob.Store interface.

func (Store) List

func (s Store) List(_ context.Context, start string, f func(string) error) error

List implements a method of the blob.Store interface.

func (Store) Put

Put implements a method of the blob.Store interface. This implementation always reports an error, since the store is read-only.

Jump to

Keyboard shortcuts

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