bt_gitstore

package
v0.0.0-...-93b6c00 Latest Latest
Warning

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

Go to latest
Published: Apr 25, 2024 License: BSD-3-Clause Imports: 24 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DEPRECATED_TABLE_ID = "git-repos"

	METRIC_BT_REQS_READ  = "bt_gitstore_reqs_read"
	METRIC_BT_REQS_WRITE = "bt_gitstore_reqs_write"
	METRIC_BT_ROWS_READ  = "bt_gitstore_rows_read"
	METRIC_BT_ROWS_WRITE = "bt_gitstore_rows_write"
)
View Source
const (

	// Default number of shards used, if not shards provided in BTConfig.
	DefaultShards = 32

	// DefaultWriteGoroutines defines the maximum number of goroutines
	// used to write to BigTable concurrently, if not provided in BTConfig.
	// This number was shown to keep memory usage reasonably low while still
	// providing decent throughput.
	DefaultWriteGoroutines = 100
)

Variables

This section is empty.

Functions

func AllRepos

func AllRepos(ctx context.Context, conf *BTConfig) (map[string]*gitstore.RepoInfo, error)

AllRepos returns a map of all repos contained in given BigTable project/instance/table. It returns map[normalized_URL]RepoInfo.

func InitBT

func InitBT(conf *BTConfig) error

InitBT initializes the BT instance for the given configuration. It uses the default way to get auth information from the environment and must be called with an account that has admin rights.

func NewBTGitStoreMap

func NewBTGitStoreMap(ctx context.Context, repoUrls []string, btConf *BTConfig) (repograph.Map, error)

NewGitStoreMap returns a Map instance with Graphs for the given GitStores.

func RepoURLFromID

func RepoURLFromID(ctx context.Context, conf *BTConfig, repoIDStr string) (string, bool)

RepoURLFromID retrieves the URL of a repository by its corresponding numeric ID. If a repository with the given ID can be found it will be returned and the second return value is true. In any other case "" and false will be returned.

Types

type BTConfig

type BTConfig struct {
	ProjectID       string
	InstanceID      string
	TableID         string
	AppProfile      string
	Shards          int
	WriteGoroutines int
}

BTConfig contains the BigTable configuration to define where the repo should be stored.

func BTTestConfig

func BTTestConfig() *BTConfig

BTTestConfig returns a BTConfig which can be used for testing.

type BigTableGitStore

type BigTableGitStore struct {
	RepoID  int64
	RepoURL string
	// contains filtered or unexported fields
}

BigTableGitStore implements the GitStore interface based on BigTable.

func New

func New(ctx context.Context, config *BTConfig, repoURL string) (*BigTableGitStore, error)

New returns an instance of GitStore that uses BigTable as its backend storage. The given repoURL serves to identify the repository. Internally it is stored normalized via a call to git.NormalizeURL.

func (*BigTableGitStore) Get

func (b *BigTableGitStore) Get(ctx context.Context, hashes []string) ([]*vcsinfo.LongCommit, error)

Get implements the GitStore interface.

func (*BigTableGitStore) GetBranches

func (b *BigTableGitStore) GetBranches(ctx context.Context) (map[string]*gitstore.BranchPointer, error)

GetBranches implements the GitStore interface.

func (*BigTableGitStore) Put

func (b *BigTableGitStore) Put(ctx context.Context, commits []*vcsinfo.LongCommit) error

Put implements the GitStore interface.

func (*BigTableGitStore) PutBranches

func (b *BigTableGitStore) PutBranches(ctx context.Context, branches map[string]string) error

PutBranches implements the GitStore interface.

func (*BigTableGitStore) RangeByTime

func (b *BigTableGitStore) RangeByTime(ctx context.Context, start, end time.Time, branch string) ([]*vcsinfo.IndexCommit, error)

RangeByTime implements the GitStore interface.

func (*BigTableGitStore) RangeN

func (b *BigTableGitStore) RangeN(ctx context.Context, startIndex, endIndex int, branch string) ([]*vcsinfo.IndexCommit, error)

RangeN implements the GitStore interface.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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