revision

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Aug 31, 2022 License: Apache-2.0 Imports: 22 Imported by: 0

Documentation

Index

Constants

View Source
const (
	WorkingVersion = "working-version"
)

Variables

View Source
var (
	ErrFileNotFound = errors.New("file not found")
)
View Source
var ErrRepositoryNotExists = errors.New("repository does not exist")

Functions

This section is empty.

Types

type DiffFile added in v0.2.0

type DiffFile struct {
	State      State
	Path       string
	CommitID   string
	CommitDate time.Time
}

func (DiffFile) Skip added in v0.2.0

func (d DiffFile) Skip() bool

Skip return an empty Diff because the line contained a commit-id.

type PublishStats added in v0.2.0

type PublishStats struct {
	Deleted int
	Updated int
}

type Publisher added in v0.2.0

type Publisher interface {
	Publish(ctx context.Context, messages ...*domainpb.IndexMessage) error
}

type PublisherStats added in v0.2.0

type PublisherStats struct {
	DatasetHash    string
	RepoHash       string
	TotalPublished int
	New            int
	Updated        int
	Deleted        int
}

type Repository

type Repository struct {
	OrgID     string
	DatasetID string
	// contains filtered or unexported fields
}

func (*Repository) Add

func (repo *Repository) Add(path string) error

Add adds all files with path to the staging area.

func (*Repository) Changes added in v0.2.0

func (repo *Repository) Changes(path, from, until string) (chan DiffFile, error)

func (*Repository) Commit

func (repo *Repository) Commit(msg string, options *gitgo.CommitOptions) (plumbing.Hash, error)

func (*Repository) Exists added in v0.2.0

func (repo *Repository) Exists(path string) bool

func (*Repository) HEAD added in v0.2.0

func (repo *Repository) HEAD() (plumbing.Hash, error)

func (*Repository) IsClean added in v0.2.0

func (repo *Repository) IsClean() bool

func (*Repository) Publish added in v0.2.0

func (repo *Repository) Publish(msg string) (PublisherStats, error)

func (*Repository) PublishChanged added in v0.2.0

func (repo *Repository) PublishChanged(from, until string, p ...Publisher) (PublishStats, error)

func (*Repository) Read

func (repo *Repository) Read(path, revision string) (io.ReadCloser, error)

Read returns a Reader for the given path for a specific revision. When the revision is empty the HEAD version in returned.

func (*Repository) ResetPath added in v0.2.0

func (repo *Repository) ResetPath(path string) error

ResetPath removes all entries for a directory path.

This functionality allows full reingests to mark deleted entries.

func (*Repository) SingleFlight

func (repo *Repository) SingleFlight(path string, r io.Reader, commitMessage string) (plumbing.Hash, error)

SingleFlight writes io.Reader to path and creates a commit with commitMessage.

func (*Repository) Status

func (repo *Repository) Status() (gitgo.Status, error)

func (*Repository) Write

func (repo *Repository) Write(path string, r io.Reader) error

Write writes the content of io.Reader to a file at path. When the file does not exist a new file is created.

You must repo.Add with the path before it can be committed.

An error is only returned when creating or write to the file fails.

type Service

type Service struct {
	BareRepo bool
	// contains filtered or unexported fields
}

func NewService

func NewService(path string) (*Service, error)

func (*Service) InitRepository

func (s *Service) InitRepository(organization, dataset string) (*Repository, error)

InitRepository initializes a Repository and returns it.

An error is only returned if there are underlying FS errors.

func (*Service) OpenRepository

func (s *Service) OpenRepository(organization, dataset string) (*Repository, error)

OpenRepository returns an *Repository. When the Repository is not initialized or does not exist a ErrRepositoryNotExists is returned.

To create a repository you need to call InitRepository.

func (*Service) ServeHTTP

func (s *Service) ServeHTTP(w http.ResponseWriter, r *http.Request)

type State added in v0.2.0

type State string
var (
	StatusAdded    State = "A"
	StatusDeleted  State = "D"
	StatusModified State = "M"
)

Jump to

Keyboard shortcuts

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