mongodb

package
v1.2.1 Latest Latest
Warning

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

Go to latest
Published: Jan 10, 2024 License: Apache-2.0, BSD-3-Clause, MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type PolicyEvent

type PolicyEvent struct {
	OperationType string         `bson:"operationType"`
	Policy        storage.Policy `bson:"fullDocument"`
}

type Storage

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

func New

func New(db *mongo.Client, dbname, collection string, logger *zap.Logger) (*Storage, error)

func (*Storage) ActiveImportConfigs added in v1.2.0

func (s *Storage) ActiveImportConfigs(ctx context.Context) ([]*storage.PolicyAutoImport, error)

func (*Storage) AddPolicySubscribers added in v1.2.0

func (s *Storage) AddPolicySubscribers(subscribers ...storage.PolicySubscriber)

func (*Storage) AutoImportConfig added in v1.2.0

func (s *Storage) AutoImportConfig(ctx context.Context, policyURL string) (*storage.PolicyAutoImport, error)

func (*Storage) AutoImportConfigs added in v1.2.0

func (s *Storage) AutoImportConfigs(ctx context.Context) ([]*storage.PolicyAutoImport, error)

func (*Storage) Close

func (s *Storage) Close(ctx context.Context)

func (*Storage) CreateSubscriber

func (s *Storage) CreateSubscriber(ctx context.Context, subscriber *storage.Subscriber) (*storage.Subscriber, error)

func (*Storage) DeleteAutoImportConfig added in v1.2.0

func (s *Storage) DeleteAutoImportConfig(ctx context.Context, policyURL string) error

func (*Storage) DeleteData

func (s *Storage) DeleteData(ctx context.Context, key string) error

func (*Storage) GetData

func (s *Storage) GetData(ctx context.Context, key string) (any, error)

func (*Storage) GetPolicies

func (s *Storage) GetPolicies(ctx context.Context, locked *bool, policyName *string) ([]*storage.Policy, error)

func (*Storage) GetRefreshPolicies

func (s *Storage) GetRefreshPolicies(ctx context.Context) ([]*storage.Policy, error)

func (*Storage) ListenPolicyDataChanges

func (s *Storage) ListenPolicyDataChanges(ctx context.Context) error

func (*Storage) Policy

func (s *Storage) Policy(ctx context.Context, repository, group, name, version string) (*storage.Policy, error)

func (*Storage) PolicySubscribers added in v1.2.0

func (s *Storage) PolicySubscribers(ctx context.Context, policyRepository, policyName, policyGroup, policyVersion string) ([]*storage.Subscriber, error)

func (*Storage) SaveAutoImportConfig added in v1.2.0

func (s *Storage) SaveAutoImportConfig(ctx context.Context, importConfig *storage.PolicyAutoImport) error

func (*Storage) SavePolicy

func (s *Storage) SavePolicy(ctx context.Context, policy *storage.Policy) error

func (*Storage) SetData

func (s *Storage) SetData(ctx context.Context, key string, data map[string]interface{}) error

func (*Storage) SetPolicyLock

func (s *Storage) SetPolicyLock(ctx context.Context, repository, group, name, version string, lock bool) error

func (*Storage) Subscriber added in v1.2.0

func (s *Storage) Subscriber(ctx context.Context, policyRepository, policyGroup, policyName, policyVersion, webhookURL, name string) (*storage.Subscriber, error)

func (*Storage) Transaction

func (s *Storage) Transaction(ctx context.Context, callback func(mCtx mongo.SessionContext) (interface{}, error)) (interface{}, error)

func (*Storage) UpdateNextRefreshTime

func (s *Storage) UpdateNextRefreshTime(ctx context.Context, p *storage.Policy, nextDataRefreshTime time.Time) error

UpdateNextRefreshTime updates policy's data and nextDataRefreshTimeField fields

Jump to

Keyboard shortcuts

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