core

package
v2.1.2+incompatible Latest Latest
Warning

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

Go to latest
Published: Jan 11, 2016 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Hash

type Hash [20]byte

Hash SHA1 hased content

func ComputeHash

func ComputeHash(t ObjectType, content []byte) Hash

ComputeHash compute the hash for a given ObjectType and content

func NewHash

func NewHash(s string) Hash

NewHash return a new Hash from a hexadecimal hash representation

func (Hash) IsZero

func (h Hash) IsZero() bool

func (Hash) String

func (h Hash) String() string

type Object

type Object interface {
	Type() ObjectType
	SetType(ObjectType)
	Size() int64
	SetSize(int64)
	Hash() Hash
	Reader() io.Reader
	Writer() io.Writer
}

Object is a generic representation of any git object

type ObjectStorage

type ObjectStorage interface {
	New() Object
	Set(Object) Hash
	Get(Hash) (Object, bool)
}

ObjectStorage generic storage of objects

type ObjectType

type ObjectType int8

ObjectType internal object type's

const (
	CommitObject   ObjectType = 1
	TreeObject     ObjectType = 2
	BlobObject     ObjectType = 3
	TagObject      ObjectType = 4
	OFSDeltaObject ObjectType = 6
	REFDeltaObject ObjectType = 7
)

func (ObjectType) Bytes

func (t ObjectType) Bytes() []byte

func (ObjectType) String

func (t ObjectType) String() string

type PermanentError

type PermanentError struct {
	Err error
}

func NewPermanentError

func NewPermanentError(err error) *PermanentError

func (*PermanentError) Error

func (e *PermanentError) Error() string

type RAWObject

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

func (*RAWObject) Hash

func (o *RAWObject) Hash() Hash

func (*RAWObject) Reader

func (o *RAWObject) Reader() io.Reader

func (*RAWObject) SetSize

func (o *RAWObject) SetSize(s int64)

func (*RAWObject) SetType

func (o *RAWObject) SetType(t ObjectType)

func (*RAWObject) Size

func (o *RAWObject) Size() int64

func (*RAWObject) Type

func (o *RAWObject) Type() ObjectType

func (*RAWObject) Write

func (o *RAWObject) Write(p []byte) (n int, err error)

func (*RAWObject) Writer

func (o *RAWObject) Writer() io.Writer

type RAWObjectStorage

type RAWObjectStorage struct {
	Objects map[Hash]Object
	Commits map[Hash]Object
	Trees   map[Hash]Object
	Blobs   map[Hash]Object
}

func NewRAWObjectStorage

func NewRAWObjectStorage() *RAWObjectStorage

func (*RAWObjectStorage) Get

func (o *RAWObjectStorage) Get(h Hash) (Object, bool)

func (*RAWObjectStorage) New

func (o *RAWObjectStorage) New() Object

func (*RAWObjectStorage) Set

func (o *RAWObjectStorage) Set(obj Object) Hash

type UnexpectedError

type UnexpectedError struct {
	Err error
}

func NewUnexpectedError

func NewUnexpectedError(err error) *UnexpectedError

func (*UnexpectedError) Error

func (e *UnexpectedError) Error() string

Jump to

Keyboard shortcuts

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