storage

package
v0.1.7 Latest Latest
Warning

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

Go to latest
Published: May 9, 2024 License: BSD-3-Clause Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrRuleNotFound = errors.New("rule not found")

	ErrInstanceNotFound      = errors.New("instance not found")
	ErrInstanceAlreadyExists = errors.New("instance already exists")

	ErrSyncStorageLocked = errors.New("sync already locked")

	ErrACLAPISyncedRuleNotFound = errors.New("aclapi synced rule not found")
)
View Source
var GetACLAPIStorage = func() (ACLAPIStorage, error) {
	return nil, errors.New("no acl api storage imported")
}
View Source
var GetRuleStorage = func() (RuleStorage, error) {
	return nil, errors.New("no rule storage imported")
}
View Source
var GetServiceStorage = func() (ServiceStorage, error) {
	return nil, errors.New("no service storage imported")
}
View Source
var GetSyncStorage = func() (SyncStorage, error) {
	return nil, errors.New("no sync storage imported")
}

Functions

This section is empty.

Types

type ACLAPIStorage

type ACLAPIStorage interface {
	Find(ruleID string) (ACLAPISyncedRule, error)
	Add(ruleID string, aclIDs []ACLIdPair) error
	Remove(ruleID string, aclIDs []ACLIdPair) error
}

type ACLAPISyncedRule

type ACLAPISyncedRule struct {
	RuleID string
	ACLIds []ACLIdPair
}

type ACLIdPair

type ACLIdPair struct {
	NetworkID string
	ACLRuleID string
}

type DeleteOpts

type DeleteOpts struct {
	ID       string
	Metadata map[string]string
}

type FindOpts

type FindOpts struct {
	Metadata map[string]string
	Creator  string

	SourceTsuruApp string
	SourceTsuruJob string
}

type RuleStorage

type RuleStorage interface {
	Find(id string) (types.Rule, error)
	Save(rules []*types.Rule, upsert bool) error
	FindAll(opts FindOpts) ([]types.Rule, error)
	Delete(opts DeleteOpts) error
}

type ServiceStorage

type ServiceStorage interface {
	Create(instance types.ServiceInstance) error
	List() ([]types.ServiceInstance, error)
	Find(instanceName string) (types.ServiceInstance, error)
	Delete(instanceName string) error
	AddRule(instanceName string, r *types.ServiceRule) error
	RemoveRule(instanceName string, ruleID string) error
	AddApp(instanceName string, appName string) error
	RemoveApp(instanceName string, appName string) error
	AddJob(instanceName string, jobName string) error
	RemoveJob(instanceName string, jobName string) error
}

type StoredIP

type StoredIP struct {
	IP         net.IP
	ValidUntil time.Time
}

type SyncFindOpts

type SyncFindOpts struct {
	RuleIDs []string
	Engines []string
	Limit   int
}

type SyncStorage

type SyncStorage interface {
	Find(opts SyncFindOpts) ([]types.RuleSyncInfo, error)
	StartSync(after time.Duration, ruleID, engine string, force bool) (time.Duration, *types.RuleSyncInfo, error)
	PingSyncs(ruleSyncIDs []string) error
	EndSync(ruleSync types.RuleSyncInfo, syncData types.RuleSyncData) error
	SetLockExpireTime(timeout time.Duration) time.Duration
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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