db

package
v0.0.0-...-b945540 Latest Latest
Warning

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

Go to latest
Published: Dec 23, 2024 License: BSD-3-Clause Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ChangesCol

type ChangesCol string

func GetChangesCol

func GetChangesCol(internal bool) ChangesCol

Utility function to return which changes col name to use based on if the change is internal or not.

type DB

type DB interface {
	// GetCurrentChanges returns the changes that were processed by the last
	// iteration. If none is found in DB then an empty map is returned.
	GetCurrentChanges(ctx context.Context) (map[string]*types.CurrentlyProcessingChange, error)

	// PutCurrentChanges returns the changes that were processed by the last
	// iteration.
	PutCurrentChanges(ctx context.Context, currentChangesCache interface{}) error

	// GetChangeAttempts returns all ChangeAttempts in the DB for this
	// change+patchset.
	GetChangeAttempts(ctx context.Context, changeID, patchsetID int64, changesCol ChangesCol) (*types.ChangeAttempts, error)

	// UpdateChangeAttemptAsAbandoned marks the specified change attempt as
	// abandoned.
	UpdateChangeAttemptAsAbandoned(ctx context.Context, changeID, patchsetID int64, changesCol ChangesCol, patchStart int64) error

	// PutChangeAttempts adds the specified change attempt to the DB.
	PutChangeAttempt(ctx context.Context, newChangeAttempt *types.ChangeAttempt, changesCol ChangesCol) error
}

func New

func New(ctx context.Context, ts oauth2.TokenSource, fsNamespace, fsProjectId string) (DB, error)

New returns an instance of FirestoreDB.

type FirestoreDB

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

FirestoreDB uses Cloud Firestore for storage and implements the DB interface.

func (*FirestoreDB) GetChangeAttempts

func (f *FirestoreDB) GetChangeAttempts(ctx context.Context, changeID, patchsetID int64, changesCol ChangesCol) (*types.ChangeAttempts, error)

GetChangeAttempts implements the DB interface.

func (*FirestoreDB) GetCurrentChanges

func (f *FirestoreDB) GetCurrentChanges(ctx context.Context) (map[string]*types.CurrentlyProcessingChange, error)

GetCurrentChanges implements the DB interface.

func (*FirestoreDB) PutChangeAttempt

func (f *FirestoreDB) PutChangeAttempt(ctx context.Context, newChangeAttempt *types.ChangeAttempt, changesCol ChangesCol) error

PutChangeAttempt implements the DB interface.

func (*FirestoreDB) PutCurrentChanges

func (f *FirestoreDB) PutCurrentChanges(ctx context.Context, currentChangesCache interface{}) error

PutCurrentChanges implements the DB interface.

func (*FirestoreDB) UpdateChangeAttemptAsAbandoned

func (f *FirestoreDB) UpdateChangeAttemptAsAbandoned(ctx context.Context, changeID, patchsetID int64, changesCol ChangesCol, patchStart int64) error

UpdateChangeAttemptAsAbandoned implements the DB interface.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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