Documentation
¶
Index ¶
- Constants
- Variables
- type ContainerRecord
- type DeleteOptions
- type ListOptions
- type ServiceIDOrNameOptions
- type Store
- func (s *Store) CreateMachine(ctx context.Context, m *pb.MachineInfo) error
- func (s *Store) CreateOrUpdateContainer(ctx context.Context, ctr api.ServiceContainer, machineID string) error
- func (s *Store) DBVersion(ctx context.Context) (int64, error)
- func (s *Store) Delete(ctx context.Context, key string) error
- func (s *Store) DeleteContainers(ctx context.Context, opts DeleteOptions) error
- func (s *Store) DeleteMachine(ctx context.Context, id string) error
- func (s *Store) Get(ctx context.Context, key string, value any) error
- func (s *Store) GetMachine(ctx context.Context, machineID string) (*pb.MachineInfo, error)
- func (s *Store) ListContainers(ctx context.Context, opts ListOptions) ([]ContainerRecord, error)
- func (s *Store) ListMachines(ctx context.Context) ([]*pb.MachineInfo, error)
- func (s *Store) Put(ctx context.Context, key string, value any) error
- func (s *Store) SubscribeContainers(ctx context.Context) ([]ContainerRecord, <-chan struct{}, error)
- func (s *Store) SubscribeMachines(ctx context.Context) ([]*pb.MachineInfo, <-chan struct{}, error)
- func (s *Store) UpdateMachine(ctx context.Context, m *pb.MachineInfo) error
Constants ¶
const ( // SyncStatusSynced indicates that a container record is synchronised with the Docker daemon. The record may // become outdated even when the status is "synced" if the machine crashes or a network partition occurs. // The cluster membership state of the machine should also be checked to determine if the record can be trusted. SyncStatusSynced = "synced" // SyncStatusOutdated indicates that a container record may be outdated, for example, due to being unable // to retrieve the container's state from the Docker daemon or when the machine is being stopped or restarted. SyncStatusOutdated = "outdated" )
Variables ¶
Functions ¶
This section is empty.
Types ¶
type ContainerRecord ¶
type DeleteOptions ¶
type DeleteOptions struct {
IDs []string
}
type ListOptions ¶
type ListOptions struct {
// MachineIDs filters containers by the machine IDs they are running on.
MachineIDs []string
ServiceIDOrName ServiceIDOrNameOptions
}
type ServiceIDOrNameOptions ¶
ServiceIDOrNameOptions filters containers by the service ID or name they are part of. If both ID and Name are provided, they are combined with an OR operator.
type Store ¶
type Store struct {
// contains filtered or unexported fields
}
Store is a cluster store backed by a distributed Corrosion database.
func (*Store) CreateMachine ¶
func (*Store) CreateOrUpdateContainer ¶
func (s *Store) CreateOrUpdateContainer(ctx context.Context, ctr api.ServiceContainer, machineID string) error
CreateOrUpdateContainer creates a new container record or updates an existing one in the store database. The container is associated with the given machine ID that indicates which machine the container is running on.
func (*Store) DBVersion ¶ added in v0.16.0
DBVersion returns the current cr-sqlite database version (Lamport timestamp).
func (*Store) DeleteContainers ¶
func (s *Store) DeleteContainers(ctx context.Context, opts DeleteOptions) error
DeleteContainers deletes container records from the store database that match the given options.
func (*Store) DeleteMachine ¶ added in v0.10.0
func (*Store) GetMachine ¶ added in v0.10.0
func (*Store) ListContainers ¶
func (s *Store) ListContainers(ctx context.Context, opts ListOptions) ([]ContainerRecord, error)
ListContainers returns a list of container records from the store database that match the given options.
func (*Store) ListMachines ¶
func (*Store) SubscribeContainers ¶
func (s *Store) SubscribeContainers(ctx context.Context) ([]ContainerRecord, <-chan struct{}, error)
SubscribeContainers returns a list of containers and a channel that signals changes to the list. The channel doesn't receive any values, it just signals when a container(s) has been added, updated, or deleted in the database.
func (*Store) SubscribeMachines ¶
SubscribeMachines returns a list of machines and a channel that signals changes to the list. The channel doesn't receive any values, it just signals when a machine has been added, updated, or deleted in the database.