Documentation
¶
Overview ¶
Package postgres implements the storage.Store interface using PostgreSQL.
This is the HA storage driver for multi-instance EdgeFabric controller deployments. It uses pgx via the database/sql compatibility layer.
Index ¶
- type Migration
- type PostgresStore
- func (s *PostgresStore) AddNodeToGroup(ctx context.Context, groupID, nodeID domain.ID) error
- func (s *PostgresStore) Close() error
- func (s *PostgresStore) CreateAPIKey(ctx context.Context, k *domain.APIKey) error
- func (s *PostgresStore) CreateAuditEvent(ctx context.Context, e *domain.AuditEvent) error
- func (s *PostgresStore) CreateBGPSession(ctx context.Context, sess *domain.BGPSession) error
- func (s *PostgresStore) CreateCDNOrigin(ctx context.Context, o *domain.CDNOrigin) error
- func (s *PostgresStore) CreateCDNSite(ctx context.Context, site *domain.CDNSite) error
- func (s *PostgresStore) CreateDNSRecord(ctx context.Context, r *domain.DNSRecord) error
- func (s *PostgresStore) CreateDNSZone(ctx context.Context, z *domain.DNSZone) error
- func (s *PostgresStore) CreateEnrollmentToken(ctx context.Context, t *domain.EnrollmentToken) error
- func (s *PostgresStore) CreateGateway(ctx context.Context, g *domain.Gateway) error
- func (s *PostgresStore) CreateIPAllocation(ctx context.Context, ip *domain.IPAllocation) error
- func (s *PostgresStore) CreateNode(ctx context.Context, n *domain.Node) error
- func (s *PostgresStore) CreateNodeGroup(ctx context.Context, g *domain.NodeGroup) error
- func (s *PostgresStore) CreateProvisioningJob(ctx context.Context, j *domain.ProvisioningJob) error
- func (s *PostgresStore) CreateRoute(ctx context.Context, r *domain.Route) error
- func (s *PostgresStore) CreateSSHKey(ctx context.Context, k *domain.SSHKey) error
- func (s *PostgresStore) CreateTLSCertificate(ctx context.Context, c *domain.TLSCertificate) error
- func (s *PostgresStore) CreateTenant(ctx context.Context, t *domain.Tenant) error
- func (s *PostgresStore) CreateUser(ctx context.Context, u *domain.User) error
- func (s *PostgresStore) CreateWireGuardPeer(ctx context.Context, p *domain.WireGuardPeer) error
- func (s *PostgresStore) DB() *sql.DB
- func (s *PostgresStore) DeleteAPIKey(ctx context.Context, id domain.ID) error
- func (s *PostgresStore) DeleteBGPSession(ctx context.Context, id domain.ID) error
- func (s *PostgresStore) DeleteCDNOrigin(ctx context.Context, id domain.ID) error
- func (s *PostgresStore) DeleteCDNSite(ctx context.Context, id domain.ID) error
- func (s *PostgresStore) DeleteDNSRecord(ctx context.Context, id domain.ID) error
- func (s *PostgresStore) DeleteDNSZone(ctx context.Context, id domain.ID) error
- func (s *PostgresStore) DeleteGateway(ctx context.Context, id domain.ID) error
- func (s *PostgresStore) DeleteIPAllocation(ctx context.Context, id domain.ID) error
- func (s *PostgresStore) DeleteNode(ctx context.Context, id domain.ID) error
- func (s *PostgresStore) DeleteNodeGroup(ctx context.Context, id domain.ID) error
- func (s *PostgresStore) DeleteRoute(ctx context.Context, id domain.ID) error
- func (s *PostgresStore) DeleteSSHKey(ctx context.Context, id domain.ID) error
- func (s *PostgresStore) DeleteTLSCertificate(ctx context.Context, id domain.ID) error
- func (s *PostgresStore) DeleteTenant(ctx context.Context, id domain.ID) error
- func (s *PostgresStore) DeleteUser(ctx context.Context, id domain.ID) error
- func (s *PostgresStore) DeleteWireGuardPeer(ctx context.Context, id domain.ID) error
- func (s *PostgresStore) GetAPIKey(ctx context.Context, id domain.ID) (*domain.APIKey, error)
- func (s *PostgresStore) GetAPIKeyByPrefix(ctx context.Context, prefix string) (*domain.APIKey, error)
- func (s *PostgresStore) GetActiveProvisioningJob(ctx context.Context, nodeID domain.ID) (*domain.ProvisioningJob, error)
- func (s *PostgresStore) GetBGPSession(ctx context.Context, id domain.ID) (*domain.BGPSession, error)
- func (s *PostgresStore) GetCDNOrigin(ctx context.Context, id domain.ID) (*domain.CDNOrigin, error)
- func (s *PostgresStore) GetCDNSite(ctx context.Context, id domain.ID) (*domain.CDNSite, error)
- func (s *PostgresStore) GetDNSRecord(ctx context.Context, id domain.ID) (*domain.DNSRecord, error)
- func (s *PostgresStore) GetDNSZone(ctx context.Context, id domain.ID) (*domain.DNSZone, error)
- func (s *PostgresStore) GetEnrollmentToken(ctx context.Context, token string) (*domain.EnrollmentToken, error)
- func (s *PostgresStore) GetGateway(ctx context.Context, id domain.ID) (*domain.Gateway, error)
- func (s *PostgresStore) GetIPAllocation(ctx context.Context, id domain.ID) (*domain.IPAllocation, error)
- func (s *PostgresStore) GetNode(ctx context.Context, id domain.ID) (*domain.Node, error)
- func (s *PostgresStore) GetNodeGroup(ctx context.Context, id domain.ID) (*domain.NodeGroup, error)
- func (s *PostgresStore) GetProvisioningJob(ctx context.Context, id domain.ID) (*domain.ProvisioningJob, error)
- func (s *PostgresStore) GetRoute(ctx context.Context, id domain.ID) (*domain.Route, error)
- func (s *PostgresStore) GetSSHKey(ctx context.Context, id domain.ID) (*domain.SSHKey, error)
- func (s *PostgresStore) GetTLSCertificate(ctx context.Context, id domain.ID) (*domain.TLSCertificate, error)
- func (s *PostgresStore) GetTenant(ctx context.Context, id domain.ID) (*domain.Tenant, error)
- func (s *PostgresStore) GetTenantBySlug(ctx context.Context, slug string) (*domain.Tenant, error)
- func (s *PostgresStore) GetUser(ctx context.Context, id domain.ID) (*domain.User, error)
- func (s *PostgresStore) GetUserByEmail(ctx context.Context, email string) (*domain.User, error)
- func (s *PostgresStore) GetWireGuardPeer(ctx context.Context, id domain.ID) (*domain.WireGuardPeer, error)
- func (s *PostgresStore) GetWireGuardPeerByOwner(ctx context.Context, ownerType domain.PeerOwnerType, ownerID domain.ID) (*domain.WireGuardPeer, error)
- func (s *PostgresStore) IncrementDNSZoneSerial(ctx context.Context, id domain.ID) error
- func (s *PostgresStore) ListAPIKeys(ctx context.Context, tenantID domain.ID, params storage.ListParams) ([]*domain.APIKey, int, error)
- func (s *PostgresStore) ListAuditEvents(ctx context.Context, tenantID *domain.ID, params storage.ListParams) ([]*domain.AuditEvent, int, error)
- func (s *PostgresStore) ListBGPSessions(ctx context.Context, nodeID domain.ID, params storage.ListParams) ([]*domain.BGPSession, int, error)
- func (s *PostgresStore) ListCDNOrigins(ctx context.Context, siteID domain.ID, params storage.ListParams) ([]*domain.CDNOrigin, int, error)
- func (s *PostgresStore) ListCDNSites(ctx context.Context, tenantID domain.ID, params storage.ListParams) ([]*domain.CDNSite, int, error)
- func (s *PostgresStore) ListDNSRecords(ctx context.Context, zoneID domain.ID, params storage.ListParams) ([]*domain.DNSRecord, int, error)
- func (s *PostgresStore) ListDNSZones(ctx context.Context, tenantID domain.ID, params storage.ListParams) ([]*domain.DNSZone, int, error)
- func (s *PostgresStore) ListGateways(ctx context.Context, tenantID *domain.ID, params storage.ListParams) ([]*domain.Gateway, int, error)
- func (s *PostgresStore) ListGroupNodes(ctx context.Context, groupID domain.ID) ([]*domain.Node, error)
- func (s *PostgresStore) ListIPAllocations(ctx context.Context, tenantID domain.ID, params storage.ListParams) ([]*domain.IPAllocation, int, error)
- func (s *PostgresStore) ListNodeGroups(ctx context.Context, tenantID domain.ID, params storage.ListParams) ([]*domain.NodeGroup, int, error)
- func (s *PostgresStore) ListNodeGroups_ByNode(ctx context.Context, nodeID domain.ID) ([]*domain.NodeGroup, error)
- func (s *PostgresStore) ListNodes(ctx context.Context, tenantID *domain.ID, params storage.ListParams) ([]*domain.Node, int, error)
- func (s *PostgresStore) ListProvisioningJobs(ctx context.Context, nodeID *domain.ID, params storage.ListParams) ([]*domain.ProvisioningJob, int, error)
- func (s *PostgresStore) ListRoutes(ctx context.Context, tenantID domain.ID, params storage.ListParams) ([]*domain.Route, int, error)
- func (s *PostgresStore) ListRoutesByGateway(ctx context.Context, gatewayID domain.ID) ([]*domain.Route, error)
- func (s *PostgresStore) ListSSHKeys(ctx context.Context, params storage.ListParams) ([]*domain.SSHKey, int, error)
- func (s *PostgresStore) ListTLSCertificates(ctx context.Context, tenantID domain.ID, params storage.ListParams) ([]*domain.TLSCertificate, int, error)
- func (s *PostgresStore) ListTenants(ctx context.Context, params storage.ListParams) ([]*domain.Tenant, int, error)
- func (s *PostgresStore) ListUsers(ctx context.Context, tenantID *domain.ID, params storage.ListParams) ([]*domain.User, int, error)
- func (s *PostgresStore) ListWireGuardPeers(ctx context.Context, params storage.ListParams) ([]*domain.WireGuardPeer, int, error)
- func (s *PostgresStore) MarkEnrollmentTokenUsed(ctx context.Context, id domain.ID) error
- func (s *PostgresStore) Migrate(ctx context.Context) error
- func (s *PostgresStore) Ping(ctx context.Context) error
- func (s *PostgresStore) RemoveNodeFromGroup(ctx context.Context, groupID, nodeID domain.ID) error
- func (s *PostgresStore) SchemaVersion(ctx context.Context) (int, error)
- func (s *PostgresStore) UpdateAPIKeyLastUsed(ctx context.Context, id domain.ID) error
- func (s *PostgresStore) UpdateBGPSession(ctx context.Context, sess *domain.BGPSession) error
- func (s *PostgresStore) UpdateCDNOrigin(ctx context.Context, o *domain.CDNOrigin) error
- func (s *PostgresStore) UpdateCDNSite(ctx context.Context, site *domain.CDNSite) error
- func (s *PostgresStore) UpdateDNSRecord(ctx context.Context, r *domain.DNSRecord) error
- func (s *PostgresStore) UpdateDNSZone(ctx context.Context, z *domain.DNSZone) error
- func (s *PostgresStore) UpdateGateway(ctx context.Context, g *domain.Gateway) error
- func (s *PostgresStore) UpdateGatewayConfigSync(ctx context.Context, id domain.ID) error
- func (s *PostgresStore) UpdateGatewayHeartbeat(ctx context.Context, id domain.ID) error
- func (s *PostgresStore) UpdateIPAllocation(ctx context.Context, ip *domain.IPAllocation) error
- func (s *PostgresStore) UpdateNode(ctx context.Context, n *domain.Node) error
- func (s *PostgresStore) UpdateNodeConfigSync(ctx context.Context, id domain.ID) error
- func (s *PostgresStore) UpdateNodeGroup(ctx context.Context, g *domain.NodeGroup) error
- func (s *PostgresStore) UpdateNodeHeartbeat(ctx context.Context, id domain.ID) error
- func (s *PostgresStore) UpdateProvisioningJob(ctx context.Context, j *domain.ProvisioningJob) error
- func (s *PostgresStore) UpdateRoute(ctx context.Context, r *domain.Route) error
- func (s *PostgresStore) UpdateSSHKey(ctx context.Context, k *domain.SSHKey) error
- func (s *PostgresStore) UpdateTenant(ctx context.Context, t *domain.Tenant) error
- func (s *PostgresStore) UpdateUser(ctx context.Context, u *domain.User) error
- func (s *PostgresStore) UpdateWireGuardPeer(ctx context.Context, p *domain.WireGuardPeer) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type PostgresStore ¶
type PostgresStore struct {
// contains filtered or unexported fields
}
PostgresStore implements storage.Store using PostgreSQL.
func New ¶
func New(dsn string) (*PostgresStore, error)
New creates a new PostgreSQL store with connection pooling.
func (*PostgresStore) AddNodeToGroup ¶
func (*PostgresStore) Close ¶
func (s *PostgresStore) Close() error
Close closes the database connection pool.
func (*PostgresStore) CreateAPIKey ¶
func (*PostgresStore) CreateAuditEvent ¶
func (s *PostgresStore) CreateAuditEvent(ctx context.Context, e *domain.AuditEvent) error
func (*PostgresStore) CreateBGPSession ¶
func (s *PostgresStore) CreateBGPSession(ctx context.Context, sess *domain.BGPSession) error
func (*PostgresStore) CreateCDNOrigin ¶
func (*PostgresStore) CreateCDNSite ¶
func (*PostgresStore) CreateDNSRecord ¶
func (*PostgresStore) CreateDNSZone ¶
func (*PostgresStore) CreateEnrollmentToken ¶
func (s *PostgresStore) CreateEnrollmentToken(ctx context.Context, t *domain.EnrollmentToken) error
func (*PostgresStore) CreateGateway ¶
func (*PostgresStore) CreateIPAllocation ¶
func (s *PostgresStore) CreateIPAllocation(ctx context.Context, ip *domain.IPAllocation) error
func (*PostgresStore) CreateNode ¶
func (*PostgresStore) CreateNodeGroup ¶
func (*PostgresStore) CreateProvisioningJob ¶
func (s *PostgresStore) CreateProvisioningJob(ctx context.Context, j *domain.ProvisioningJob) error
func (*PostgresStore) CreateRoute ¶
func (*PostgresStore) CreateSSHKey ¶
func (*PostgresStore) CreateTLSCertificate ¶
func (s *PostgresStore) CreateTLSCertificate(ctx context.Context, c *domain.TLSCertificate) error
func (*PostgresStore) CreateTenant ¶
func (*PostgresStore) CreateUser ¶
func (*PostgresStore) CreateWireGuardPeer ¶
func (s *PostgresStore) CreateWireGuardPeer(ctx context.Context, p *domain.WireGuardPeer) error
func (*PostgresStore) DB ¶
func (s *PostgresStore) DB() *sql.DB
DB returns the underlying *sql.DB for use by the leader elector. Advisory locks require a dedicated connection from the same pool.
func (*PostgresStore) DeleteAPIKey ¶
func (*PostgresStore) DeleteBGPSession ¶
func (*PostgresStore) DeleteCDNOrigin ¶
func (*PostgresStore) DeleteCDNSite ¶
func (*PostgresStore) DeleteDNSRecord ¶
func (*PostgresStore) DeleteDNSZone ¶
func (*PostgresStore) DeleteGateway ¶
func (*PostgresStore) DeleteIPAllocation ¶
func (*PostgresStore) DeleteNode ¶
func (*PostgresStore) DeleteNodeGroup ¶
func (*PostgresStore) DeleteRoute ¶
func (*PostgresStore) DeleteSSHKey ¶
func (*PostgresStore) DeleteTLSCertificate ¶
func (*PostgresStore) DeleteTenant ¶
func (*PostgresStore) DeleteUser ¶
func (*PostgresStore) DeleteWireGuardPeer ¶
func (*PostgresStore) GetAPIKeyByPrefix ¶
func (*PostgresStore) GetActiveProvisioningJob ¶
func (s *PostgresStore) GetActiveProvisioningJob(ctx context.Context, nodeID domain.ID) (*domain.ProvisioningJob, error)
func (*PostgresStore) GetBGPSession ¶
func (s *PostgresStore) GetBGPSession(ctx context.Context, id domain.ID) (*domain.BGPSession, error)
func (*PostgresStore) GetCDNOrigin ¶
func (*PostgresStore) GetCDNSite ¶
func (*PostgresStore) GetDNSRecord ¶
func (*PostgresStore) GetDNSZone ¶
func (*PostgresStore) GetEnrollmentToken ¶
func (s *PostgresStore) GetEnrollmentToken(ctx context.Context, token string) (*domain.EnrollmentToken, error)
func (*PostgresStore) GetGateway ¶
func (*PostgresStore) GetIPAllocation ¶
func (s *PostgresStore) GetIPAllocation(ctx context.Context, id domain.ID) (*domain.IPAllocation, error)
func (*PostgresStore) GetNodeGroup ¶
func (*PostgresStore) GetProvisioningJob ¶
func (s *PostgresStore) GetProvisioningJob(ctx context.Context, id domain.ID) (*domain.ProvisioningJob, error)
func (*PostgresStore) GetTLSCertificate ¶
func (s *PostgresStore) GetTLSCertificate(ctx context.Context, id domain.ID) (*domain.TLSCertificate, error)
func (*PostgresStore) GetTenantBySlug ¶
func (*PostgresStore) GetUserByEmail ¶
func (*PostgresStore) GetWireGuardPeer ¶
func (s *PostgresStore) GetWireGuardPeer(ctx context.Context, id domain.ID) (*domain.WireGuardPeer, error)
func (*PostgresStore) GetWireGuardPeerByOwner ¶
func (s *PostgresStore) GetWireGuardPeerByOwner(ctx context.Context, ownerType domain.PeerOwnerType, ownerID domain.ID) (*domain.WireGuardPeer, error)
func (*PostgresStore) IncrementDNSZoneSerial ¶
func (*PostgresStore) ListAPIKeys ¶
func (*PostgresStore) ListAuditEvents ¶
func (s *PostgresStore) ListAuditEvents(ctx context.Context, tenantID *domain.ID, params storage.ListParams) ([]*domain.AuditEvent, int, error)
func (*PostgresStore) ListBGPSessions ¶
func (s *PostgresStore) ListBGPSessions(ctx context.Context, nodeID domain.ID, params storage.ListParams) ([]*domain.BGPSession, int, error)
func (*PostgresStore) ListCDNOrigins ¶
func (*PostgresStore) ListCDNSites ¶
func (*PostgresStore) ListDNSRecords ¶
func (*PostgresStore) ListDNSZones ¶
func (*PostgresStore) ListGateways ¶
func (*PostgresStore) ListGroupNodes ¶
func (*PostgresStore) ListIPAllocations ¶
func (s *PostgresStore) ListIPAllocations(ctx context.Context, tenantID domain.ID, params storage.ListParams) ([]*domain.IPAllocation, int, error)
func (*PostgresStore) ListNodeGroups ¶
func (*PostgresStore) ListNodeGroups_ByNode ¶
func (*PostgresStore) ListProvisioningJobs ¶
func (s *PostgresStore) ListProvisioningJobs(ctx context.Context, nodeID *domain.ID, params storage.ListParams) ([]*domain.ProvisioningJob, int, error)
func (*PostgresStore) ListRoutes ¶
func (*PostgresStore) ListRoutesByGateway ¶
func (*PostgresStore) ListSSHKeys ¶
func (s *PostgresStore) ListSSHKeys(ctx context.Context, params storage.ListParams) ([]*domain.SSHKey, int, error)
func (*PostgresStore) ListTLSCertificates ¶
func (s *PostgresStore) ListTLSCertificates(ctx context.Context, tenantID domain.ID, params storage.ListParams) ([]*domain.TLSCertificate, int, error)
func (*PostgresStore) ListTenants ¶
func (s *PostgresStore) ListTenants(ctx context.Context, params storage.ListParams) ([]*domain.Tenant, int, error)
func (*PostgresStore) ListWireGuardPeers ¶
func (s *PostgresStore) ListWireGuardPeers(ctx context.Context, params storage.ListParams) ([]*domain.WireGuardPeer, int, error)
func (*PostgresStore) MarkEnrollmentTokenUsed ¶
func (*PostgresStore) Migrate ¶
func (s *PostgresStore) Migrate(ctx context.Context) error
Migrate runs database migrations to ensure the schema is current.
func (*PostgresStore) Ping ¶
func (s *PostgresStore) Ping(ctx context.Context) error
Ping checks database connectivity.
func (*PostgresStore) RemoveNodeFromGroup ¶
func (*PostgresStore) SchemaVersion ¶
func (s *PostgresStore) SchemaVersion(ctx context.Context) (int, error)
SchemaVersion returns the latest applied schema version number.
func (*PostgresStore) UpdateAPIKeyLastUsed ¶
func (*PostgresStore) UpdateBGPSession ¶
func (s *PostgresStore) UpdateBGPSession(ctx context.Context, sess *domain.BGPSession) error
func (*PostgresStore) UpdateCDNOrigin ¶
func (*PostgresStore) UpdateCDNSite ¶
func (*PostgresStore) UpdateDNSRecord ¶
func (*PostgresStore) UpdateDNSZone ¶
func (*PostgresStore) UpdateGateway ¶
func (*PostgresStore) UpdateGatewayConfigSync ¶
func (*PostgresStore) UpdateGatewayHeartbeat ¶
func (*PostgresStore) UpdateIPAllocation ¶
func (s *PostgresStore) UpdateIPAllocation(ctx context.Context, ip *domain.IPAllocation) error
func (*PostgresStore) UpdateNode ¶
func (*PostgresStore) UpdateNodeConfigSync ¶
func (*PostgresStore) UpdateNodeGroup ¶
func (*PostgresStore) UpdateNodeHeartbeat ¶
func (*PostgresStore) UpdateProvisioningJob ¶
func (s *PostgresStore) UpdateProvisioningJob(ctx context.Context, j *domain.ProvisioningJob) error
func (*PostgresStore) UpdateRoute ¶
func (*PostgresStore) UpdateSSHKey ¶
func (*PostgresStore) UpdateTenant ¶
func (*PostgresStore) UpdateUser ¶
func (*PostgresStore) UpdateWireGuardPeer ¶
func (s *PostgresStore) UpdateWireGuardPeer(ctx context.Context, p *domain.WireGuardPeer) error