datastore

package
v0.58.0 Latest Latest
Warning

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

Go to latest
Published: Aug 23, 2026 License: Apache-2.0 Imports: 8 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

View Source
const (
	// Operation to find the field is equal to the specified value.
	OperatorEqual = iota + 1
	// Operation to find the field isn't equal to the specified value.
	OperatorNotEqual
	// Operation to find ones that contain any one of the multiple values.
	OperatorIn
	// Operation to find ones that do not contain any of the specified multiple values.
	OperatorNotIn
	// Operation to find ones the field is greater than the specified value.
	OperatorGreaterThan
	// Operation to find ones the field is greater or equal than the specified value.
	OperatorGreaterThanOrEqual
	// Operation to find ones the field is less than the specified value.
	OperatorLessThan
	// Operation to find ones the field is less or equal than the specified value.
	OperatorLessThanOrEqual
	// Operation to find ones that have a specified value in its array.
	OperatorContains
)

Variables

View Source
var (
	ErrNotFound        = errors.New("not found")
	ErrInvalidArgument = errors.New("invalid argument")
	ErrAlreadyExists   = errors.New("already exists")
	ErrInvalidCursor   = errors.New("invalid cursor")
	ErrIteratorDone    = errors.New("iterator is done")
	ErrInternal        = errors.New("internal")
	ErrUnimplemented   = errors.New("unimplemented")
	ErrUnsupported     = errors.New("unsupported")
	ErrUserDefined     = errors.New("user defined error")
)

Functions

This section is empty.

Types

type APIKeyStore

type APIKeyStore interface {
	Add(ctx context.Context, k *model.APIKey) error
	Get(ctx context.Context, id string) (*model.APIKey, error)
	List(ctx context.Context, opts ListOptions) ([]*model.APIKey, error)
	Disable(ctx context.Context, id, projectID string) error
	UpdateLastUsedAt(ctx context.Context, id string, time int64) error
}

func NewAPIKeyStore

func NewAPIKeyStore(ds DataStore) APIKeyStore

type ApplicationStore

type ApplicationStore interface {
	Add(ctx context.Context, app *model.Application) error
	Get(ctx context.Context, id string) (*model.Application, error)
	List(ctx context.Context, opts ListOptions) ([]*model.Application, string, error)
	Delete(ctx context.Context, id string) error
	Enable(ctx context.Context, id string) error
	Disable(ctx context.Context, id string) error
	UpdateSyncState(ctx context.Context, id string, syncState *model.ApplicationSyncState) error
	UpdateMostRecentDeployment(ctx context.Context, id string, status model.DeploymentStatus, deployment *model.ApplicationDeploymentReference) error
	UpdateConfigFilename(ctx context.Context, id, configFilename string) error
	UpdateDeployingStatus(ctx context.Context, id string, deploying bool) error
	UpdateBasicInfo(ctx context.Context, id, name, description string, labels map[string]string) error
	UpdateConfiguration(ctx context.Context, id, pipedID, platformProvider, configFilename string, deployTargetsByPlugin map[string]*model.DeployTargets) error
	UpdatePlatformProvider(ctx context.Context, id string, provider string) error
	UpdateDeployTargets(ctx context.Context, id string, dp map[string]*model.DeployTargets) error
}

func NewApplicationStore

func NewApplicationStore(ds DataStore) ApplicationStore

type Collection added in v0.24.1

type Collection interface {
	Kind() string
	Factory() Factory
}

type CommandStore

type CommandStore interface {
	Add(ctx context.Context, cmd *model.Command) error
	Get(ctx context.Context, id string) (*model.Command, error)
	List(ctx context.Context, opts ListOptions) ([]*model.Command, error)
	UpdateStatus(ctx context.Context, id string, status model.CommandStatus, metadata map[string]string, handledAt int64) error
}

func NewCommandStore

func NewCommandStore(ds DataStore) CommandStore

type DataStore

type DataStore interface {
	// Find finds the documents matched given criteria.
	Find(ctx context.Context, col Collection, opts ListOptions) (Iterator, error)
	// Get gets one document specified with ID, and unmarshal it to typed struct.
	// If the document can not be found in datastore, ErrNotFound will be returned.
	Get(ctx context.Context, col Collection, id string, entity interface{}) error
	// Create saves a new entity to the datastore.
	// If an entity with the same ID is already existing, ErrAlreadyExists will be returned.
	Create(ctx context.Context, col Collection, id string, entity interface{}) error
	// Update updates an existing entity in the datastore.
	// If updating entity was not found in the datastore, ErrNotFound will be returned.
	Update(ctx context.Context, col Collection, id string, updater Updater) error
	// Close closes datastore resources held by the client.
	Close() error
}

type DeploymentChainStore

type DeploymentChainStore interface {
	Add(ctx context.Context, d *model.DeploymentChain) error
	Get(ctx context.Context, id string) (*model.DeploymentChain, error)
	List(ctx context.Context, opts ListOptions) ([]*model.DeploymentChain, string, error)
	AddNodeDeployment(ctx context.Context, chainID string, deployment *model.Deployment) error
	UpdateNodeDeploymentStatus(ctx context.Context, chainID string, blockIndex uint32, deploymentID string, status model.DeploymentStatus, reason string) error
}

func NewDeploymentChainStore

func NewDeploymentChainStore(ds DataStore) DeploymentChainStore

type DeploymentStore

type DeploymentStore interface {
	Add(ctx context.Context, d *model.Deployment) error
	Get(ctx context.Context, id string) (*model.Deployment, error)
	List(ctx context.Context, opts ListOptions) ([]*model.Deployment, string, error)
	UpdateToPlanned(ctx context.Context, id, summary, reason, runningCommitHash, runningConfigFilename string, syncStrategy model.SyncStrategy, versions []*model.ArtifactVersion, stages []*model.PipelineStage) error
	UpdateToCompleted(ctx context.Context, id string, status model.DeploymentStatus, stageStatuses map[string]model.StageStatus, reason string, completedAt int64) error
	UpdateStatus(ctx context.Context, id string, status model.DeploymentStatus, reason string) error
	UpdateStageStatus(ctx context.Context, id, stageID string, status model.StageStatus, reason string, requires []string, visible bool, retriedCount int32, completedAt int64) error
	// Deprecated: Use UpdateSharedMetadata or UpdatePluginMetadata instead in pipedv1. UpdateMetadata is for pipedv0.
	UpdateMetadata(ctx context.Context, id string, metadata map[string]string) error
	UpdateStageMetadata(ctx context.Context, deploymentID, stageID string, metadata map[string]string) error
	UpdateSharedMetadata(ctx context.Context, id string, metadata map[string]string) error
	UpdatePluginMetadata(ctx context.Context, id string, pluginName string, metadata map[string]string) error
}

func NewDeploymentStore

func NewDeploymentStore(ds DataStore) DeploymentStore

type DeploymentTraceStore added in v0.51.0

type DeploymentTraceStore interface {
	Add(ctx context.Context, d model.DeploymentTrace) error
	List(ctx context.Context, opts ListOptions) ([]*model.DeploymentTrace, string, error)
}

func NewDeploymentTraceStore added in v0.51.0

func NewDeploymentTraceStore(ds DataStore) DeploymentTraceStore

type EventStore

type EventStore interface {
	Add(ctx context.Context, e model.Event) error
	List(ctx context.Context, opts ListOptions) ([]*model.Event, string, error)
	UpdateStatus(ctx context.Context, eventID string, status model.EventStatus, statusDescription string) error
}

func NewEventStore

func NewEventStore(ds DataStore) EventStore

type Factory

type Factory func() interface{}

type Iterator

type Iterator interface {
	Next(dst interface{}) error
	Cursor() (string, error)
}

type ListFilter

type ListFilter struct {
	Field    string
	Operator Operator
	Value    interface{}
}

type ListOptions

type ListOptions struct {
	Limit   int
	Filters []ListFilter
	Orders  []Order
	Cursor  string
}

type MockCollection added in v0.24.1

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

MockCollection is a mock of Collection interface.

func NewMockCollection added in v0.24.1

func NewMockCollection(ctrl *gomock.Controller) *MockCollection

NewMockCollection creates a new mock instance.

func (*MockCollection) EXPECT added in v0.24.1

EXPECT returns an object that allows the caller to indicate expected use.

func (*MockCollection) Factory added in v0.24.1

func (m *MockCollection) Factory() Factory

Factory mocks base method.

func (*MockCollection) Kind added in v0.24.1

func (m *MockCollection) Kind() string

Kind mocks base method.

type MockCollectionMockRecorder added in v0.24.1

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

MockCollectionMockRecorder is the mock recorder for MockCollection.

func (*MockCollectionMockRecorder) Factory added in v0.24.1

func (mr *MockCollectionMockRecorder) Factory() *gomock.Call

Factory indicates an expected call of Factory.

func (*MockCollectionMockRecorder) Kind added in v0.24.1

Kind indicates an expected call of Kind.

type MockDataStore

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

MockDataStore is a mock of DataStore interface.

func NewMockDataStore

func NewMockDataStore(ctrl *gomock.Controller) *MockDataStore

NewMockDataStore creates a new mock instance.

func (*MockDataStore) Close

func (m *MockDataStore) Close() error

Close mocks base method.

func (*MockDataStore) Create

func (m *MockDataStore) Create(ctx context.Context, col Collection, id string, entity interface{}) error

Create mocks base method.

func (*MockDataStore) EXPECT

EXPECT returns an object that allows the caller to indicate expected use.

func (*MockDataStore) Find

func (m *MockDataStore) Find(ctx context.Context, col Collection, opts ListOptions) (Iterator, error)

Find mocks base method.

func (*MockDataStore) Get

func (m *MockDataStore) Get(ctx context.Context, col Collection, id string, entity interface{}) error

Get mocks base method.

func (*MockDataStore) Update

func (m *MockDataStore) Update(ctx context.Context, col Collection, id string, updater Updater) error

Update mocks base method.

type MockDataStoreMockRecorder

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

MockDataStoreMockRecorder is the mock recorder for MockDataStore.

func (*MockDataStoreMockRecorder) Close

func (mr *MockDataStoreMockRecorder) Close() *gomock.Call

Close indicates an expected call of Close.

func (*MockDataStoreMockRecorder) Create

func (mr *MockDataStoreMockRecorder) Create(ctx, col, id, entity interface{}) *gomock.Call

Create indicates an expected call of Create.

func (*MockDataStoreMockRecorder) Find

func (mr *MockDataStoreMockRecorder) Find(ctx, col, opts interface{}) *gomock.Call

Find indicates an expected call of Find.

func (*MockDataStoreMockRecorder) Get

func (mr *MockDataStoreMockRecorder) Get(ctx, col, id, entity interface{}) *gomock.Call

Get indicates an expected call of Get.

func (*MockDataStoreMockRecorder) Update

func (mr *MockDataStoreMockRecorder) Update(ctx, col, id, updater interface{}) *gomock.Call

Update indicates an expected call of Update.

type MockIterator

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

MockIterator is a mock of Iterator interface.

func NewMockIterator

func NewMockIterator(ctrl *gomock.Controller) *MockIterator

NewMockIterator creates a new mock instance.

func (*MockIterator) Cursor

func (m *MockIterator) Cursor() (string, error)

Cursor mocks base method.

func (*MockIterator) EXPECT

EXPECT returns an object that allows the caller to indicate expected use.

func (*MockIterator) Next

func (m *MockIterator) Next(dst interface{}) error

Next mocks base method.

type MockIteratorMockRecorder

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

MockIteratorMockRecorder is the mock recorder for MockIterator.

func (*MockIteratorMockRecorder) Cursor

func (mr *MockIteratorMockRecorder) Cursor() *gomock.Call

Cursor indicates an expected call of Cursor.

func (*MockIteratorMockRecorder) Next

func (mr *MockIteratorMockRecorder) Next(dst interface{}) *gomock.Call

Next indicates an expected call of Next.

type Operator

type Operator int

type Order

type Order struct {
	Field     string
	Direction OrderDirection
}

type OrderDirection

type OrderDirection int
const (
	// Asc sorts results from smallest to largest.
	Asc OrderDirection = iota + 1
	// Desc sorts results from largest to smallest.
	Desc
)

type PipedStore

type PipedStore interface {
	Add(ctx context.Context, piped *model.Piped) error
	Get(ctx context.Context, id string) (*model.Piped, error)
	List(ctx context.Context, opts ListOptions) ([]*model.Piped, error)
	UpdateInfo(ctx context.Context, id, name, desc string) error
	EnablePiped(ctx context.Context, id string) error
	DisablePiped(ctx context.Context, id string) error
	UpdateDesiredVersion(ctx context.Context, id, version string) error
	UpdateMetadata(ctx context.Context, id, version, config string, pps []*model.Piped_PlatformProvider, pls []*model.Piped_Plugin, repos []*model.ApplicationGitRepository, se *model.Piped_SecretEncryption, startedAt int64) error
	AddKey(ctx context.Context, id, keyHash, creator string, createdAt time.Time) error
	DeleteOldKeys(ctx context.Context, id string) error
}

func NewPipedStore

func NewPipedStore(ds DataStore) PipedStore

type ProjectStore

type ProjectStore interface {
	Add(ctx context.Context, proj *model.Project) error
	Get(ctx context.Context, id string) (*model.Project, error)
	List(ctx context.Context, opts ListOptions) ([]model.Project, error)
	UpdateProjectStaticAdmin(ctx context.Context, id, username, password string) error
	EnableStaticAdmin(ctx context.Context, id string) error
	DisableStaticAdmin(ctx context.Context, id string) error
	UpdateProjectSSOConfig(ctx context.Context, id string, sso *model.ProjectSSOConfig) error
	UpdateProjectRBACConfig(ctx context.Context, id string, rbac *model.ProjectRBACConfig) error
	AddProjectRBACRole(ctx context.Context, id, name string, policies []*model.ProjectRBACPolicy) error
	UpdateProjectRBACRole(ctx context.Context, id, name string, policies []*model.ProjectRBACPolicy) error
	DeleteProjectRBACRole(ctx context.Context, id, name string) error
	AddProjectUserGroup(ctx context.Context, id, sso, role string) error
	DeleteProjectUserGroup(ctx context.Context, id, sso string) error
}

func NewProjectStore

func NewProjectStore(ds DataStore) ProjectStore

type Updater

type Updater func(interface{}) error

Directories

Path Synopsis
Package datastoretest is a generated GoMock package.
Package datastoretest is a generated GoMock package.

Jump to

Keyboard shortcuts

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