container

package
v0.0.22 Latest Latest
Warning

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

Go to latest
Published: Jul 8, 2021 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// BucketContainerName represents the name of the bucket where this service stores data.
	BucketContainerName = "container-name"
	// BucketContainerID only stores keys for container id
	BucketContainerID = "container-id"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Service

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

Service represents a service for managing endpoint data.

func NewService

func NewService(db *bolt.DB) (*Service, error)

NewService creates a new instance of a service.

func (*Service) BatchUpdateContainers

func (service *Service) BatchUpdateContainers(ctx context.Context, containers ...climodel.ContainerExtend) error

BatchUpdateContainers 批量更新 container 1. bucket key 格式是容器的 name#container_id 2. bucket key 格式是容器的 id

func (*Service) CreateDatabase added in v0.0.4

func (service *Service) CreateDatabase() (
	bucketCN *bolt.Bucket,
	bucketCI *bolt.Bucket,
	err error,
)

CreateDatabase create bucket

func (*Service) DB

func (service *Service) DB() *bolt.DB

DB return db instance

func (*Service) DeleteContainer

func (service *Service) DeleteContainer(ID string) error

DeleteContainer deletes an endpoint.

func (*Service) DeleteContainerInIDBucket added in v0.0.11

func (service *Service) DeleteContainerInIDBucket(ctx context.Context, idList ...string) error

func (*Service) FindAllContainers

func (service *Service) FindAllContainers() ([]climodel.ContainerExtend, error)

FindAllContainers return an array containing all containers

func (*Service) FuzzyFindContainerByName

func (service *Service) FuzzyFindContainerByName(name string) ([]climodel.ContainerExtend, error)

FuzzyFindContainerByName Endpoints return an array containing all the endpoints.

func (*Service) GetContainByID added in v0.0.10

func (service *Service) GetContainByID(id string) (*climodel.ContainerExtend, error)

GetContainByID find container by ID.

func (*Service) SyncEndpointContainer added in v0.0.11

func (service *Service) SyncEndpointContainer(
	ctx context.Context,
	endpointID int,
	containers ...climodel.ContainerExtend,
) error

SyncEndpointContainer sync containers upon endpoint

func (*Service) Synchronize added in v0.0.10

func (service *Service) Synchronize(toCreate, toUpdate, toDelete []*climodel.ContainerExtend) error

Synchronize creates, updates and deletes endpoints inside a single transaction.

func (*Service) TruncateDatabase added in v0.0.4

func (service *Service) TruncateDatabase() error

TruncateDatabase delete bucket

func (*Service) UpdateContainer

func (service *Service) UpdateContainer(ID string, container *climodel.ContainerExtend) error

UpdateContainer UpdateEndpoint updates an endpoint. TODO need to update data in BucketContainerName

Jump to

Keyboard shortcuts

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