storage

package
v0.0.0-...-aa9fdee Latest Latest
Warning

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

Go to latest
Published: Aug 21, 2021 License: MPL-2.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrUnsupportedObjectType = errors.New("unsupported object type")

Functions

This section is empty.

Types

type ConfigStorage

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

func (*ConfigStorage) Config

func (c *ConfigStorage) Config() (*config.Config, error)

func (*ConfigStorage) SetConfig

func (c *ConfigStorage) SetConfig(cfg *config.Config) error

type EncodedObjectIter

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

EncodedObjectIter looks up objects by hash.

func (*EncodedObjectIter) Close

func (iter *EncodedObjectIter) Close()

func (*EncodedObjectIter) ForEach

func (iter *EncodedObjectIter) ForEach(cb func(plumbing.EncodedObject) error) error

func (*EncodedObjectIter) Next

type IndexStorage

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

func (*IndexStorage) Index

func (c *IndexStorage) Index() (*index.Index, error)

func (*IndexStorage) SetIndex

func (c *IndexStorage) SetIndex(idx *index.Index) error

type ModuleStorage

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

func NewModuleStorage

func NewModuleStorage(fs *unixfs.Unixfs) ModuleStorage

func (*ModuleStorage) Module

func (s *ModuleStorage) Module(name string) (storage.Storer, error)

type ObjectStorage

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

func NewObjectStorage

func NewObjectStorage(fs *unixfs.Unixfs) ObjectStorage

func (*ObjectStorage) EncodedObject

EncodedObject gets an object by hash with the given plumbing.ObjectType. Implementors should return (nil, plumbing.ErrObjectNotFound) if an object doesn't exist with both the given hash and object type.

Valid plumbing.ObjectType values are CommitObject, BlobObject, TagObject, TreeObject and AnyObject. If plumbing.AnyObject is given, the object must be looked up regardless of its type.

func (*ObjectStorage) EncodedObjectSize

func (o *ObjectStorage) EncodedObjectSize(h plumbing.Hash) (int64, error)

EncodedObjectSize returns the plaintext size of the encoded object.

func (*ObjectStorage) HasEncodedObject

func (o *ObjectStorage) HasEncodedObject(h plumbing.Hash) error

HasEncodedObject returns ErrObjNotFound if the object doesn't exist. If the object does exist, it returns nil.

func (*ObjectStorage) IterEncodedObjects

func (o *ObjectStorage) IterEncodedObjects(t plumbing.ObjectType) (storer.EncodedObjectIter, error)

IterObjects returns a custom EncodedObjectStorer over all the object on the storage.

Valid plumbing.ObjectType values are CommitObject, BlobObject, TagObject,

func (*ObjectStorage) NewEncodedObject

func (o *ObjectStorage) NewEncodedObject() plumbing.EncodedObject

NewEncodedObject returns a new plumbing.EncodedObject, the real type of the object can be a custom implementation or the default one, plumbing.MemoryObject.

func (*ObjectStorage) Objects

func (o *ObjectStorage) Objects() ([]plumbing.Hash, error)

Objects returns a list of all object hashes.

func (*ObjectStorage) SetEncodedObject

func (o *ObjectStorage) SetEncodedObject(obj plumbing.EncodedObject) (plumbing.Hash, error)

SetEncodedObject saves an object into the storage, the object should be create with the NewEncodedObject, method, and file if the type is not supported.

type ReferenceStorage

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

func NewReferenceStorage

func NewReferenceStorage(fs *unixfs.Unixfs) ReferenceStorage

func (*ReferenceStorage) CheckAndSetReference

func (r *ReferenceStorage) CheckAndSetReference(ref, old *plumbing.Reference) error

CheckAndSetReference sets the reference `new`, but if `old` is not `nil`, it first checks that the current stored value for `old.Name()` matches the given reference value in `old`. If not, it returns an error and doesn't update `new`.

func (*ReferenceStorage) CountLooseRefs

func (r *ReferenceStorage) CountLooseRefs() (int, error)

func (*ReferenceStorage) IterReferences

func (r *ReferenceStorage) IterReferences() (storer.ReferenceIter, error)

func (*ReferenceStorage) PackRefs

func (r *ReferenceStorage) PackRefs() error

func (*ReferenceStorage) Reference

func (*ReferenceStorage) References

func (r *ReferenceStorage) References() ([]*plumbing.Reference, error)

func (*ReferenceStorage) RemoveReference

func (r *ReferenceStorage) RemoveReference(n plumbing.ReferenceName) error

func (*ReferenceStorage) SetReference

func (r *ReferenceStorage) SetReference(ref *plumbing.Reference) error

type ShallowStorage

type ShallowStorage []plumbing.Hash

func (*ShallowStorage) SetShallow

func (s *ShallowStorage) SetShallow(commits []plumbing.Hash) error

func (ShallowStorage) Shallow

func (s ShallowStorage) Shallow() ([]plumbing.Hash, error)

type Storage

type Storage struct {
	ConfigStorage
	ObjectStorage
	ShallowStorage
	IndexStorage
	ReferenceStorage
	ModuleStorage
	// contains filtered or unexported fields
}

Storage is an implementation of git.Storer

func LoadStorage

func LoadStorage(ctx context.Context, ds ipld.DAGService, id cid.Cid) (*Storage, error)

func NewStorage

func NewStorage(ctx context.Context, ds ipld.DAGService) (*Storage, error)

func (*Storage) Node

func (s *Storage) Node() (ipld.Node, error)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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