Documentation ¶
Overview ¶
Package database provides a database adapter for postgres
Index ¶
- type ActiveBuilder
- type Builder
- type BuilderConfig
- type BuilderWithCredentials
- type Measurement
- type Service
- func (s *Service) Close() error
- func (s *Service) GetActiveBuildersWithServiceCredentials(ctx context.Context) ([]domain.BuilderWithServices, error)
- func (s *Service) GetActiveConfigForBuilder(ctx context.Context, builderName string) (json.RawMessage, error)
- func (s *Service) GetActiveMeasurements(ctx context.Context) ([]domain.Measurement, error)
- func (s *Service) GetActiveMeasurementsByType(ctx context.Context, attestationType string) ([]domain.Measurement, error)
- func (s *Service) GetBuilderByIP(ip net.IP) (*domain.Builder, error)
- func (s *Service) LogEvent(ctx context.Context, eventName, builderName, name, attestationType string) error
- func (s *Service) RegisterCredentialsForBuilder(ctx context.Context, builderName, service, tlsCert string, ecdsaPubKey []byte, ...) error
- type ServiceCredential
- type ServiceCredentialRegistration
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ActiveBuilder ¶
type BuilderConfig ¶
type BuilderWithCredentials ¶
type BuilderWithCredentials struct { Name string IPAddress pgtype.Inet Credentials []ServiceCredential }
type Measurement ¶
type Measurement struct { ID int `db:"id"` Name string `db:"name"` AttestationType string `db:"attestation_type"` Measurement json.RawMessage `db:"measurement"` IsActive bool `db:"is_active"` CreatedAt time.Time `db:"created_at"` UpdatedAt time.Time `db:"updated_at"` DeprecatedAt *time.Time `db:"deprecated_at"` }
type Service ¶
func NewDatabaseService ¶
func (*Service) GetActiveBuildersWithServiceCredentials ¶
func (*Service) GetActiveConfigForBuilder ¶
func (s *Service) GetActiveConfigForBuilder(ctx context.Context, builderName string) (json.RawMessage, error)
GetActiveConfigForBuilder retrieves the active config for a builder by name
func (*Service) GetActiveMeasurements ¶
GetActiveMeasurements retrieves all measurements
func (*Service) GetActiveMeasurementsByType ¶
func (*Service) GetBuilderByIP ¶
GetBuilderByIP retrieves a builder by IP address
func (*Service) LogEvent ¶
func (s *Service) LogEvent(ctx context.Context, eventName, builderName, name, attestationType string) error
LogEvent creates a new log entry in the event_log table. It uses hash and attestation_type to fetch the corresponding measurement_id via a subquery.
func (*Service) RegisterCredentialsForBuilder ¶
func (s *Service) RegisterCredentialsForBuilder(ctx context.Context, builderName, service, tlsCert string, ecdsaPubKey []byte, measurementName, attestationType string) error
RegisterCredentialsForBuilder registers new credentials for a builder, deprecating all previous credentials It uses hash and attestation_type to fetch the corresponding measurement_id via a subquery.
type ServiceCredential ¶
type ServiceCredential struct { Service string TLSCert sql.NullString ECDSAPubKey []byte }
Click to show internal directories.
Click to hide internal directories.