repository

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Oct 17, 2018 License: Apache-2.0 Imports: 6 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type MemRepoStore

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

MemRepoStore is a memory based repo datastore

func NewMemRepoStore

func NewMemRepoStore() *MemRepoStore

NewMemRepoStore instantiates a new repo store

func (*MemRepoStore) CreateRepo

func (mrs *MemRepoStore) CreateRepo(repo *Repository) error

CreateRepo with the given repo data

func (*MemRepoStore) GetRepo

func (mrs *MemRepoStore) GetRepo(id string) (*Repository, error)

GetRepo with the given id

func (*MemRepoStore) RemoveRepo

func (mrs *MemRepoStore) RemoveRepo(id string) error

RemoveRepo with the given id

func (*MemRepoStore) UpdateRepo

func (mrs *MemRepoStore) UpdateRepo(repo *Repository) error

UpdateRepo with the given data

type Repository

type Repository struct {
	ID   string                `json:"id"`
	Refs *RepositoryReferences `json:"refs"`
}

Repository represents a single repo.

func NewRepository

func NewRepository(id string) *Repository

NewRepository instantiates an empty repo.

func (*Repository) String

func (repo *Repository) String() string

type RepositoryHead

type RepositoryHead struct {
	Ref  string        `json:"ref"`
	Hash plumbing.Hash `json:"hash"`
}

RepositoryHead contains the HEAD ref and hash information

type RepositoryReferences

type RepositoryReferences struct {

	// TODO: Although head is exposed it should be be used directly when setting its
	// value.  It is only here to until a msgpack marshaller is implemented.
	Head  RepositoryHead
	Heads map[string]plumbing.Hash
	Tags  map[string]plumbing.Hash
	// contains filtered or unexported fields
}

RepositoryReferences contains repo refs and head information.

func NewRepositoryReferences

func NewRepositoryReferences() *RepositoryReferences

NewRepositoryReferences instantiates a new RepositoryReferences structure with the defaults.

func (*RepositoryReferences) MarshalJSON

func (refs *RepositoryReferences) MarshalJSON() ([]byte, error)

MarshalJSON is a custom json marshaller for the repository specifically to handle hashes.

func (*RepositoryReferences) SetHead

func (refs *RepositoryReferences) SetHead(ref string) (plumbing.Hash, error)

SetHead given the ref. Returns an error if the ref is not found or invalid.

func (*RepositoryReferences) UpdateRef

func (refs *RepositoryReferences) UpdateRef(ref string, prev, curr plumbing.Hash) error

UpdateRef updates a repo reference given the previous hash of the ref.

type RepositoryStore

type RepositoryStore interface {
	GetRepo(string) (*Repository, error)
	CreateRepo(*Repository) error
	UpdateRepo(*Repository) error
	RemoveRepo(string) error
}

RepositoryStore is the repository storage interface that should be implemented.

Jump to

Keyboard shortcuts

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