Documentation ¶
Index ¶
- Constants
- type Service
- func (service *Service) BatchUpdateContainers(ctx context.Context, containers ...climodel.ContainerExtend) error
- func (service *Service) CreateDatabase() (bucketCN *bolt.Bucket, bucketCI *bolt.Bucket, err error)
- func (service *Service) DB() *bolt.DB
- func (service *Service) DeleteContainer(ID string) error
- func (service *Service) DeleteContainerInIDBucket(ctx context.Context, idList ...string) error
- func (service *Service) FindAllContainers() ([]climodel.ContainerExtend, error)
- func (service *Service) FuzzyFindContainerByName(name string) ([]climodel.ContainerExtend, error)
- func (service *Service) GetContainByID(id string) (*climodel.ContainerExtend, error)
- func (service *Service) SyncEndpointContainer(ctx context.Context, endpointID int, containers ...climodel.ContainerExtend) error
- func (service *Service) Synchronize(toCreate, toUpdate, toDelete []*climodel.ContainerExtend) error
- func (service *Service) TruncateDatabase() error
- func (service *Service) UpdateContainer(ID string, container *climodel.ContainerExtend) error
Constants ¶
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 ¶
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) DeleteContainer ¶
DeleteContainer deletes an endpoint.
func (*Service) DeleteContainerInIDBucket ¶ added in v0.0.11
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
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