gitstore

package
v0.0.0-...-e560ebb Latest Latest
Warning

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

Go to latest
Published: Jul 13, 2021 License: BSD-3-Clause Imports: 21 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FetchFiles

func FetchFiles(ctx context.Context, gc GitilesClient, fs FilesSpec) (map[string]string, error)

FetchFiles download files from gitiles.

func InvPathForDut

func InvPathForDut(hostname string) string

InvPathForDut generates the relative path to the inventory git repo for a given DUT. e.g. data/skylab/chromeos6/chromeos6-***.textpb

func IsEmptyErr

func IsEmptyErr(e error) bool

IsEmptyErr returns true if the given error is because of am empty commit.

Types

type FilesSpec

type FilesSpec struct {
	Project string
	Branch  string
	Paths   []string
}

FilesSpec includes required gitiles information to fetch files.

type GerritClient

type GerritClient interface {
	GetChange(ctx context.Context, in *gerrit.GetChangeRequest, opts ...grpc.CallOption) (*gerrit.ChangeInfo, error)
	CreateChange(ctx context.Context, in *gerrit.CreateChangeRequest, opts ...grpc.CallOption) (*gerrit.ChangeInfo, error)
	SubmitChange(ctx context.Context, in *gerrit.SubmitChangeRequest, opts ...grpc.CallOption) (*gerrit.ChangeInfo, error)
	AbandonChange(ctx context.Context, in *gerrit.AbandonChangeRequest, opts ...grpc.CallOption) (*gerrit.ChangeInfo, error)

	ChangeEditFileContent(ctx context.Context, in *gerrit.ChangeEditFileContentRequest, opts ...grpc.CallOption) (*empty.Empty, error)
	DeleteEditFileContent(ctx context.Context, in *gerrit.DeleteEditFileContentRequest, opts ...grpc.CallOption) (*empty.Empty, error)
	ChangeEditPublish(ctx context.Context, in *gerrit.ChangeEditPublishRequest, opts ...grpc.CallOption) (*empty.Empty, error)

	SetReview(ctx context.Context, in *gerrit.SetReviewRequest, opts ...grpc.CallOption) (*gerrit.ReviewResult, error)
}

GerritClient is a client interface for Gerrit API.

This is a subset of the interface defined at luci/common/proto/gerrit.

type GitilesClient

type GitilesClient interface {
	Log(ctx context.Context, req *gitiles.LogRequest, opts ...grpc.CallOption) (*gitiles.LogResponse, error)
	Archive(ctx context.Context, in *gitiles.ArchiveRequest, opts ...grpc.CallOption) (*gitiles.ArchiveResponse, error)
}

GitilesClient is a client interface for Gitiles API.

This is a subset of the interface defined at luci/common/proto/gitiles.

type InventoryStore

type InventoryStore struct {
	*inventory.Lab
	*inventory.Infrastructure
	// contains filtered or unexported fields
}

InventoryStore exposes skylab inventory data in git.

Call InventoryStore.Refresh() to obtain the initial inventory data. After making modifications to the inventory, call InventoryStore.Commit(). Call InventoryStore.Refresh() again if you want to use the object beyond a InventoryStore.Commit(), to re-validate the store.

func NewInventoryStore

func NewInventoryStore(gerritC GerritClient, gitilesC GitilesClient) *InventoryStore

NewInventoryStore returns a new InventoryStore.

The returned store is not refreshed, hence all inventory data is empty.

func (*InventoryStore) Commit

func (g *InventoryStore) Commit(ctx context.Context, reason string) (string, error)

Commit commits the current inventory data in the store to git.

Successful Commit() invalidates the data cached in InventoryStore(). To continue using the store, call Refresh() again. TODO(xixuan): remove this after per-file inventory is landed and tested.

func (*InventoryStore) Refresh

func (g *InventoryStore) Refresh(ctx context.Context) (rerr error)

Refresh populates inventory data in the store from git. TODO(xixuan): remove this after per-file inventory is landed and tested.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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