appstore

package
v1.153.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 5, 2026 License: Apache-2.0 Imports: 8 Imported by: 0

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

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewID

func NewID() string

NewID is a new application id.

Types

type Store

type Store struct {
	// contains filtered or unexported fields
}

Store is the PostgreSQL application store.

func New

func New(db *sql.DB) *Store

New returns a store over db.

func (*Store) AddPart

func (s *Store) AddPart(ctx context.Context, applicationID string, p application.Part) error

AddPart adds a part. A part another application holds is ErrPartTaken.

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

func (s *Store) Delete(ctx context.Context, id string) error

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) 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) Releases

func (s *Store) Releases(ctx context.Context, applicationID string) ([]application.Release, error)

Releases reads the application's releases, newest first, with their pins.

func (*Store) RemovePart

func (s *Store) RemovePart(ctx context.Context, applicationID, kind, id string) error

RemovePart removes a part and clears the released version it was held at.

func (*Store) Update

func (s *Store) Update(ctx context.Context, a *application.Application) error

Update writes the description and owner.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL