Documentation
¶
Overview ¶
Package appstore is the PostgreSQL store of applications, their parts and their releases (#2411): the tables of migration 000228, and the released_version columns it adds to scripts and portal_assets, which only this store writes.
Index ¶
- func NewID() string
- type Store
- func (s *Store) AddPart(ctx context.Context, applicationID string, p application.Part) error
- func (s *Store) ClearSchema(ctx context.Context, applicationID string) error
- func (s *Store) Create(ctx context.Context, a *application.Application) error
- func (s *Store) Delete(ctx context.Context, id string) error
- func (s *Store) Get(ctx context.Context, id string) (*application.Application, error)
- func (s *Store) GetByName(ctx context.Context, name string) (*application.Application, error)
- func (s *Store) Holding(ctx context.Context, connection, schema string) (*application.Application, error)
- func (s *Store) List(ctx context.Context) ([]application.Application, error)
- func (s *Store) Owning(ctx context.Context, kind, id string) (*application.Application, error)
- func (s *Store) Record(ctx context.Context, applicationID string, r application.Recorded) (*application.Release, error)
- func (s *Store) Release(ctx context.Context, applicationID string, number int) (*application.Release, error)
- func (s *Store) Releases(ctx context.Context, applicationID string) ([]application.Release, error)
- func (s *Store) RemovePart(ctx context.Context, applicationID, kind, id string) error
- func (s *Store) RunRoleOf(ctx context.Context, applicationID string) (*application.RunRole, error)
- func (s *Store) SetRunRole(ctx context.Context, applicationID string, h application.HeldSchema) error
- func (s *Store) SetSchema(ctx context.Context, applicationID string, h application.HeldSchema) error
- func (s *Store) Update(ctx context.Context, a *application.Application) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Store ¶
type Store struct {
// contains filtered or unexported fields
}
Store is the PostgreSQL application store.
func (*Store) ClearSchema ¶ added in v1.154.2
ClearSchema takes the schema and its run role off the application.
func (*Store) Create ¶
func (s *Store) Create(ctx context.Context, a *application.Application) error
Create inserts the application, giving it an id when it has none.
func (*Store) Delete ¶
Delete removes the application, its parts and releases, and clears the released version its parts were held at.
func (*Store) Get ¶
func (s *Store) Get(ctx context.Context, id string) (*application.Application, error)
Get reads an application by id, with its parts.
func (*Store) GetByName ¶
func (s *Store) GetByName(ctx context.Context, name string) (*application.Application, error)
GetByName reads an application by name, with its parts.
func (*Store) Holding ¶ added in v1.154.2
func (s *Store) Holding(ctx context.Context, connection, schema string) (*application.Application, error)
Holding is the application holding schema on connection.
func (*Store) List ¶
func (s *Store) List(ctx context.Context) ([]application.Application, error)
List reads every application by name, with its parts.
func (*Store) Owning ¶
func (s *Store) Owning(ctx context.Context, kind, id string) (*application.Application, error)
Owning is the application a part belongs to.
func (*Store) Record ¶
func (s *Store) Record(ctx context.Context, applicationID string, r application.Recorded) (*application.Release, error)
Record writes a release and its pins, makes it current, and holds each pinned part at its version, in one transaction. The application row is locked and its current release compared with r.After first, so of two releases decided against one current release the second fails with ErrStale and changes nothing.
func (*Store) Release ¶
func (s *Store) Release(ctx context.Context, applicationID string, number int) (*application.Release, error)
Release reads one release with its pins.
func (*Store) RemovePart ¶
RemovePart removes a part and clears the released version it was held at.
func (*Store) SetRunRole ¶ added in v1.154.2
func (s *Store) SetRunRole(ctx context.Context, applicationID string, h application.HeldSchema) error
SetRunRole stores the run role of the schema the application holds.
func (*Store) SetSchema ¶ added in v1.154.2
func (s *Store) SetSchema(ctx context.Context, applicationID string, h application.HeldSchema) error
SetSchema makes the application hold a schema and stores its run role, in one transaction. An application already holding one is refused with ErrSchemaHeld, as is a schema another application holds.
func (*Store) Update ¶
func (s *Store) Update(ctx context.Context, a *application.Application) error
Update writes the description and owner.