feat: enhance EvoBGP with new command-line options for the evobgp-agent, including a watch command for periodic configuration updates. Update go.mod with additional dependencies and improve Docker Compose setup for new services, including NATS and various worker components.
This commit is contained in:
@@ -0,0 +1,195 @@
|
||||
package store
|
||||
|
||||
import "time"
|
||||
|
||||
// Backend is the persistence abstraction for the control plane (memory, PostgreSQL, SQLite).
|
||||
type Backend interface {
|
||||
MaterializedPrefixStats() (max int, sum int)
|
||||
PeerCount() int
|
||||
PeerSessionCountsByState() map[string]int
|
||||
// DemoIDs is non-empty only after SeedDemo (memory or seeded SQL).
|
||||
DemoIDs() (tenant, moduleCDN, moduleIP, revision, speaker string)
|
||||
|
||||
ListModules(tenantID string) []*Module
|
||||
GetModule(tenantID, moduleID string) (*Module, error)
|
||||
CreateModule(tenantID string, in *Module) (*Module, error)
|
||||
UpdateModule(tenantID, moduleID string, patch *ModulePatch) (*Module, error)
|
||||
SoftDeleteModule(tenantID, moduleID string) error
|
||||
|
||||
ListCDNSources(tenantID, moduleID string) ([]*CDNSource, error)
|
||||
CreateCDNSource(tenantID, moduleID string, in *CDNSource) (*CDNSource, error)
|
||||
UpdateCDNSource(tenantID, moduleID, sourceID string, patch *CDNSourcePatch) (*CDNSource, error)
|
||||
DeleteCDNSource(tenantID, moduleID, sourceID string) error
|
||||
|
||||
ListASEntries(tenantID, moduleID string) ([]*ASEntry, error)
|
||||
CreateASEntry(tenantID, moduleID string, in *ASEntry) (*ASEntry, error)
|
||||
UpdateASEntry(tenantID, moduleID, entryID string, patch *ASEntryPatch) (*ASEntry, error)
|
||||
DeleteASEntry(tenantID, moduleID, entryID string) error
|
||||
|
||||
ListDomainEntries(tenantID, moduleID string) ([]*DomainEntry, error)
|
||||
CreateDomainEntry(tenantID, moduleID string, in *DomainEntry) (*DomainEntry, error)
|
||||
UpdateDomainEntry(tenantID, moduleID, entryID string, patch *DomainEntryPatch) (*DomainEntry, error)
|
||||
DeleteDomainEntry(tenantID, moduleID, entryID string) error
|
||||
|
||||
ListIPRangeEntries(tenantID, moduleID string) ([]*IPRangeEntry, error)
|
||||
CreateIPRangeEntry(tenantID, moduleID string, in *IPRangeEntry) (*IPRangeEntry, error)
|
||||
UpdateIPRangeEntry(tenantID, moduleID, entryID string, patch *IPRangePatch) (*IPRangeEntry, error)
|
||||
DeleteIPRangeEntry(tenantID, moduleID, entryID string) error
|
||||
|
||||
ListDohProfiles(tenantID string) ([]*DohProfile, error)
|
||||
GetDohProfile(tenantID, id string) (*DohProfile, error)
|
||||
CreateDohProfile(tenantID string, in *DohProfile) (*DohProfile, error)
|
||||
UpdateDohProfile(tenantID, id string, patch *DohProfilePatch) (*DohProfile, error)
|
||||
DeleteDohProfile(tenantID, id string) error
|
||||
|
||||
ListCommunities(tenantID string) ([]*Community, error)
|
||||
GetCommunity(tenantID, id string) (*Community, error)
|
||||
CreateCommunity(tenantID string, in *Community) (*Community, error)
|
||||
UpdateCommunity(tenantID, id string, patch *CommunityPatch) (*Community, error)
|
||||
DeleteCommunity(tenantID, id string) error
|
||||
|
||||
ListPeers(tenantID string) []*BGPPeer
|
||||
GetPeer(tenantID, id string) (*BGPPeer, error)
|
||||
CreatePeer(tenantID string, in *BGPPeer) (*BGPPeer, error)
|
||||
UpdatePeer(tenantID, id string, patch *PeerPatch) (*BGPPeer, error)
|
||||
DeletePeer(tenantID, id string) error
|
||||
|
||||
ListSpeakersForTenant(tenantID string) []*Speaker
|
||||
GetSpeaker(tenantID, speakerID string) (*Speaker, error)
|
||||
GetSpeakerAnyTenant(speakerID string) (*Speaker, error)
|
||||
CreateSpeaker(tenantID string, in *Speaker) (*Speaker, error)
|
||||
UpdateSpeaker(tenantID, id string, patch *SpeakerPatch) (*Speaker, error)
|
||||
|
||||
GetRevision(tenantID, revisionID string) (*Revision, error)
|
||||
ListRevisions(tenantID, moduleID string, cursor string, limit int) (items []*Revision, nextCursor string, hasMore bool)
|
||||
ListRevisionPrefixes(tenantID, revisionID string, cursor string, limit int) (prefixes []PrefixRow, next string, more bool)
|
||||
CreateRollbackRevision(tenantID, sourceRevisionID string) (newID string, err error)
|
||||
RevisionDiff(tenantID, aID, bID string) (map[string]any, error)
|
||||
SetLastAppliedRevision(tenantID, speakerID, revisionID string) error
|
||||
PublishRevisionForSpeaker(speakerID, revisionID string) error
|
||||
LatestPublishedRevision(speakerID string) (revisionID string, publishedAt time.Time, err error)
|
||||
|
||||
ListGlobalSettings(tenantID string) (map[string]any, error)
|
||||
PatchGlobalSettings(tenantID string, patch map[string]any) error
|
||||
}
|
||||
|
||||
// ModulePatch is a partial update for module.
|
||||
type ModulePatch struct {
|
||||
Name *string
|
||||
Enabled *bool
|
||||
Priority *int
|
||||
RefreshIntervalSec *int
|
||||
CronExpr *string
|
||||
DefaultCommunityID *string
|
||||
DohProfileID *string
|
||||
}
|
||||
|
||||
// CDNSource is a row under a CDN module.
|
||||
type CDNSource struct {
|
||||
ID string
|
||||
ModuleID string
|
||||
SourceKind string
|
||||
URL string
|
||||
Etag string
|
||||
RefreshIntervalSec *int
|
||||
CommunityID *string
|
||||
}
|
||||
|
||||
type CDNSourcePatch struct {
|
||||
SourceKind *string
|
||||
URL *string
|
||||
Etag *string
|
||||
RefreshIntervalSec *int
|
||||
CommunityID *string
|
||||
}
|
||||
|
||||
type ASEntry struct {
|
||||
ID string
|
||||
ModuleID string
|
||||
ASN *int64
|
||||
Prefix *string
|
||||
CommunityID *string
|
||||
}
|
||||
|
||||
type ASEntryPatch struct {
|
||||
ASN *int64
|
||||
Prefix *string
|
||||
CommunityID *string
|
||||
}
|
||||
|
||||
type DomainEntry struct {
|
||||
ID string
|
||||
ModuleID string
|
||||
FQDN string
|
||||
CommunityID *string
|
||||
}
|
||||
|
||||
type DomainEntryPatch struct {
|
||||
FQDN *string
|
||||
CommunityID *string
|
||||
}
|
||||
|
||||
type IPRangeEntry struct {
|
||||
ID string
|
||||
ModuleID string
|
||||
Prefix string
|
||||
CommunityID *string
|
||||
}
|
||||
|
||||
type IPRangePatch struct {
|
||||
Prefix *string
|
||||
CommunityID *string
|
||||
}
|
||||
|
||||
type DohProfile struct {
|
||||
ID string
|
||||
TenantID string
|
||||
Name string
|
||||
URL string
|
||||
TimeoutMs *int
|
||||
SecretRef *string
|
||||
}
|
||||
|
||||
type DohProfilePatch struct {
|
||||
Name *string
|
||||
URL *string
|
||||
TimeoutMs *int
|
||||
SecretRef *string
|
||||
}
|
||||
|
||||
type Community struct {
|
||||
ID string
|
||||
TenantID string
|
||||
Name string
|
||||
Kind string
|
||||
ValueJSON string
|
||||
}
|
||||
|
||||
type CommunityPatch struct {
|
||||
Name *string
|
||||
Kind *string
|
||||
ValueJSON *string
|
||||
}
|
||||
|
||||
type PeerPatch struct {
|
||||
Neighbor *string
|
||||
RemoteASN *int64
|
||||
SpeakerID *string
|
||||
Enabled *bool
|
||||
Name *string
|
||||
SessionState *string
|
||||
PoliciesJSON *string
|
||||
}
|
||||
|
||||
type SpeakerPatch struct {
|
||||
Role *string
|
||||
Endpoint *string
|
||||
MetaJSON *string
|
||||
}
|
||||
|
||||
// PrefixRow is one materialized prefix for GET /revisions/.../prefixes.
|
||||
type PrefixRow struct {
|
||||
Prefix string
|
||||
CommunityID *string
|
||||
Source string
|
||||
}
|
||||
Reference in New Issue
Block a user