manifest

package
v0.3.0-pre9 Latest Latest
Warning

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

Go to latest
Published: May 31, 2019 License: Apache-2.0 Imports: 13 Imported by: 13

Documentation

Overview

Package manifest implements support for managing JSON-based manifests in repository.

Index

Constants

This section is empty.

Variables

View Source
var ErrNotFound = errors.New("not found")

ErrNotFound is returned when the metadata item is not found.

Functions

This section is empty.

Types

type EntryMetadata

type EntryMetadata struct {
	ID      string
	Length  int
	Labels  map[string]string
	ModTime time.Time
}

EntryMetadata contains metadata about manifest item. Each manifest item has one or more labels Including required "type" label.

type Manager

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

Manager organizes JSON manifests of various kinds, including snapshot manifests

func NewManager

func NewManager(ctx context.Context, b blockManager) (*Manager, error)

NewManager returns new manifest manager for the provided block manager.

func (*Manager) Compact

func (m *Manager) Compact(ctx context.Context) error

Compact performs compaction of manifest blocks.

func (*Manager) Delete

func (m *Manager) Delete(ctx context.Context, id string) error

Delete marks the specified manifest ID for deletion.

func (*Manager) Find

func (m *Manager) Find(ctx context.Context, labels map[string]string) ([]*EntryMetadata, error)

Find returns the list of EntryMetadata for manifest entries matching all provided labels.

func (*Manager) Flush

func (m *Manager) Flush(ctx context.Context) error

Flush persists changes to manifest manager.

func (*Manager) Get

func (m *Manager) Get(ctx context.Context, id string, data interface{}) error

Get retrieves the contents of the provided manifest item by deserializing it as JSON to provided object. If the manifest is not found, returns ErrNotFound.

func (*Manager) GetMetadata

func (m *Manager) GetMetadata(ctx context.Context, id string) (*EntryMetadata, error)

GetMetadata returns metadata about provided manifest item or ErrNotFound if the item can't be found.

func (*Manager) GetRaw

func (m *Manager) GetRaw(ctx context.Context, id string) ([]byte, error)

GetRaw returns raw contents of the provided manifest (JSON bytes) or ErrNotFound if not found.

func (*Manager) Put

func (m *Manager) Put(ctx context.Context, labels map[string]string, payload interface{}) (string, error)

Put serializes the provided payload to JSON and persists it. Returns unique handle that represents the object.

func (*Manager) Refresh

func (m *Manager) Refresh(ctx context.Context) error

Refresh updates the committed blocks from the underlying storage.

Jump to

Keyboard shortcuts

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