memory

package
v4.0.0-rc1+incompatible Latest Latest
Warning

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

Go to latest
Published: Oct 19, 2016 License: MIT Imports: 3 Imported by: 0

Documentation

Overview

Package memory is a storage backend base on memory

Index

Constants

This section is empty.

Variables

View Source
var ErrUnsupportedObjectType = fmt.Errorf("unsupported object type")

Functions

This section is empty.

Types

type ConfigStorage

type ConfigStorage struct {
	RemotesConfig map[string]*config.RemoteConfig
}

func (*ConfigStorage) DeleteRemote

func (c *ConfigStorage) DeleteRemote(name string) error

func (*ConfigStorage) Remote

func (c *ConfigStorage) Remote(name string) (*config.RemoteConfig, error)

func (*ConfigStorage) Remotes

func (c *ConfigStorage) Remotes() ([]*config.RemoteConfig, error)

func (*ConfigStorage) SetRemote

func (c *ConfigStorage) SetRemote(r *config.RemoteConfig) error

type ObjectStorage

type ObjectStorage struct {
	Objects map[core.Hash]core.Object
	Commits map[core.Hash]core.Object
	Trees   map[core.Hash]core.Object
	Blobs   map[core.Hash]core.Object
	Tags    map[core.Hash]core.Object
}

ObjectStorage is the implementation of core.ObjectStorage for memory.Object

func (*ObjectStorage) Begin

func (o *ObjectStorage) Begin() core.TxObjectStorage

func (*ObjectStorage) Get

Get returns a object with the given hash

func (*ObjectStorage) Iter

Iter returns a core.ObjectIter for the given core.ObjectTybe

func (*ObjectStorage) NewObject

func (o *ObjectStorage) NewObject() core.Object

NewObject creates a new MemoryObject

func (*ObjectStorage) Set

func (o *ObjectStorage) Set(obj core.Object) (core.Hash, error)

Set stores an object, the object should be properly filled before set it.

type ReferenceStorage

type ReferenceStorage map[core.ReferenceName]*core.Reference

func (ReferenceStorage) Get

Get returns a stored reference with the given name

func (ReferenceStorage) Iter

Iter returns a core.ReferenceIter

func (ReferenceStorage) Set

func (r ReferenceStorage) Set(ref *core.Reference) error

Set stores a reference.

type Storage

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

Storage in memory storage system

func NewStorage

func NewStorage() *Storage

NewStorage returns a new Storage

func (*Storage) ConfigStorage

func (s *Storage) ConfigStorage() config.ConfigStorage

ConfigStorage return the ConfigStorage, if not exists create a new one

func (*Storage) ObjectStorage

func (s *Storage) ObjectStorage() core.ObjectStorage

ObjectStorage returns the ObjectStorage, if not exists creates a new one

func (*Storage) ReferenceStorage

func (s *Storage) ReferenceStorage() core.ReferenceStorage

ReferenceStorage returns the ReferenceStorage if not exists creates a new one

type TxObjectStorage

type TxObjectStorage struct {
	Storage *ObjectStorage
	Objects map[core.Hash]core.Object
}

func (*TxObjectStorage) Commit

func (tx *TxObjectStorage) Commit() error

func (*TxObjectStorage) Get

func (*TxObjectStorage) Rollback

func (tx *TxObjectStorage) Rollback() error

func (*TxObjectStorage) Set

func (tx *TxObjectStorage) Set(obj core.Object) (core.Hash, error)

Jump to

Keyboard shortcuts

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