root

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: 7 Imported by: 1

Documentation

Overview

Package root defines a storage representation for pointers to file trees and associated metadata.

Index

Constants

This section is empty.

Variables

View Source
var ErrNoData = errors.New("requested data not found")

ErrNoData indicates that the requested data do not exist.

Functions

func Encode

func Encode(r *Root) *wiretype.Object

Encode encodes r as a protobuf message for storage.

Types

type Options

type Options struct {
	FileKey     string
	Description string
	IndexKey    string
}

Options are configurable settings for creating a Root. A nil options pointer provides zero values for all fields.

type Root

type Root struct {
	Description string // a human-readable description
	FileKey     string // the storage key of the file node
	IndexKey    string // the storage key of the blob index
	// contains filtered or unexported fields
}

A Root records the location of the root of a file tree.

func Decode

func Decode(s blob.CAS, obj *wiretype.Object) (*Root, error)

Decode decodes a protobuf-encoded root record and associates it with the storage in s.

func New

func New(s blob.CAS, opts *Options) *Root

New constructs a new empty Root associated with the given store. If opts != nil, initial values are set from its contents.

func Open

func Open(ctx context.Context, s blob.CAS, key string) (*Root, error)

Open opens a stored root record given its storage key in s.

func (*Root) File

func (r *Root) File(ctx context.Context, s blob.CAS) (*file.File, error)

File loads and returns the root file of r from s, if one exists. If no file exists, it returns ErrNoData. If s == nil, it uses the same store as r.

func (*Root) Save

func (r *Root) Save(ctx context.Context, key string, replace bool) error

Save writes r in wire format to the given storage key in s.

Jump to

Keyboard shortcuts

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