mirror of
https://github.com/gomods/athens
synced 2026-02-10 13:28:11 +00:00
* add basic mongo implementation of pointer registry + includes LookupPointer only for now * complete implementation of mongo pointer registry + add RegiteredEventlog type for storage in registry + add unique index with key 'deployment' to match struct tag + add SetPointer implementation + update LookupPointer to use new struct type * mongo pointer registry tests + test creation of new Registry + test for addition, update and missing entry * use keyed fields for go vet
25 lines
933 B
Go
25 lines
933 B
Go
package eventlog
|
|
|
|
import "errors"
|
|
|
|
// ErrDeploymentNotFound is returned when the deployment ID is not found
|
|
// in a PointerRegistry.
|
|
var ErrDeploymentNotFound = errors.New("deployment ID not found")
|
|
|
|
// RegisteredEventlog stores the relationship between a deploymentID and
|
|
// the pointer to it's olympus server eventlog
|
|
type RegisteredEventlog struct {
|
|
DeploymentID string `bson:"deployment"`
|
|
Pointer string `bson:"ptr"`
|
|
}
|
|
|
|
// PointerRegistry is a key/value store that stores an event log pointer for one
|
|
// or more Olympus deployments. It is used in proxies (Athens) and Olympus
|
|
// deployments as part of the event log sync process
|
|
type PointerRegistry interface {
|
|
// LookupPointer returns an event log pointer for the given deployment ID.
|
|
LookupPointer(deploymentID string) (string, error)
|
|
// SetPointer records the current event log pointer for the given deployment ID.
|
|
SetPointer(deploymentID, pointer string) error
|
|
}
|