root

package
v0.2.10 Latest Latest
Warning

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

Go to latest
Published: Jul 21, 2026 License: MPL-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Attachment

type Attachment struct {
	RootID     artifactstore.RootID         `json:"rootID"`
	SourceID   artifactstore.SourceID       `json:"sourceID"`
	Role       artifactstore.AttachmentRole `json:"role"`
	Priority   int                          `json:"priority"`
	Enabled    bool                         `json:"enabled"`
	Data       json.RawMessage              `json:"data"`
	Revision   uint64                       `json:"revision"`
	CreatedAt  time.Time                    `json:"createdAt"`
	ModifiedAt time.Time                    `json:"modifiedAt"`
}

func (Attachment) Validate

func (a Attachment) Validate() error

type AttachmentDraft

type AttachmentDraft struct {
	SourceID artifactstore.SourceID
	Role     artifactstore.AttachmentRole
	Priority int
	Enabled  bool
	Data     json.RawMessage
}

type AttachmentUpdate

type AttachmentUpdate struct {
	ExpectedRootRevision       uint64
	ExpectedAttachmentRevision uint64
	Role                       artifactstore.AttachmentRole
	Priority                   int
	Enabled                    bool
	Data                       json.RawMessage
}

type Repository

type Repository interface {
	Create(
		ctx context.Context,
		root Root,
		attachments []Attachment,
	) error

	Get(
		ctx context.Context,
		id artifactstore.RootID,
		includeDeleted bool,
	) (Root, error)

	List(
		ctx context.Context,
		includeDeleted bool,
	) ([]Root, error)

	Update(
		ctx context.Context,
		value Root,
		expectedRevision uint64,
	) error

	Attach(
		ctx context.Context,
		attachment Attachment,
		expectedRootRevision uint64,
	) (Root, error)

	GetAttachment(
		ctx context.Context,
		rootID artifactstore.RootID,
		sourceID artifactstore.SourceID,
	) (Attachment, error)

	ListAttachments(
		ctx context.Context,
		rootID artifactstore.RootID,
	) ([]Attachment, error)

	UpdateAttachment(
		ctx context.Context,
		value Attachment,
		expectedRootRevision uint64,
		expectedAttachmentRevision uint64,
	) (Root, error)

	Detach(
		ctx context.Context,
		rootID artifactstore.RootID,
		sourceID artifactstore.SourceID,
		expectedRootRevision uint64,
		expectedAttachmentRevision uint64,
		modifiedAt time.Time,
	) (Root, error)
}

type Root

type Root struct {
	ID          artifactstore.RootID   `json:"id"`
	Kind        artifactstore.RootKind `json:"kind"`
	DisplayName string                 `json:"displayName"`
	Description string                 `json:"description,omitempty"`
	Enabled     bool                   `json:"enabled"`
	Data        json.RawMessage        `json:"data"`
	Revision    uint64                 `json:"revision"`
	CreatedAt   time.Time              `json:"createdAt"`
	ModifiedAt  time.Time              `json:"modifiedAt"`
	DeletedAt   *time.Time             `json:"deletedAt,omitempty"`
}

func (Root) Validate

func (r Root) Validate() error

type RootDraft

type RootDraft struct {
	Kind        artifactstore.RootKind
	DisplayName string
	Description string
	Enabled     bool
	Data        json.RawMessage
}

type RootUpdate

type RootUpdate struct {
	ExpectedRevision uint64
	DisplayName      string
	Description      string
	Enabled          bool
	Data             json.RawMessage
}

type Service

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

func NewService

func NewService(
	repository Repository,
	ids artifactstore.IDGenerator,
	clock artifactstore.Clock,
) (*Service, error)

func (*Service) Attach

func (s *Service) Attach(
	ctx context.Context,
	rootID artifactstore.RootID,
	expectedRootRevision uint64,
	draft AttachmentDraft,
) (Root, Attachment, error)

func (*Service) Create

func (s *Service) Create(
	ctx context.Context,
	draft RootDraft,
	attachmentDrafts []AttachmentDraft,
) (Root, []Attachment, error)

func (*Service) Delete

func (s *Service) Delete(
	ctx context.Context,
	id artifactstore.RootID,
	expectedRevision uint64,
) (Root, error)

func (*Service) Detach

func (s *Service) Detach(
	ctx context.Context,
	rootID artifactstore.RootID,
	sourceID artifactstore.SourceID,
	expectedRootRevision uint64,
	expectedAttachmentRevision uint64,
) (Root, error)

func (*Service) Get

func (s *Service) Get(
	ctx context.Context,
	id artifactstore.RootID,
) (Root, error)

func (*Service) GetAttachment

func (s *Service) GetAttachment(
	ctx context.Context,
	rootID artifactstore.RootID,
	sourceID artifactstore.SourceID,
) (Attachment, error)

func (*Service) GetIncludingDeleted

func (s *Service) GetIncludingDeleted(
	ctx context.Context,
	id artifactstore.RootID,
) (Root, error)

func (*Service) List

func (s *Service) List(
	ctx context.Context,
	includeDeleted bool,
) ([]Root, error)

func (*Service) ListAttachments

func (s *Service) ListAttachments(
	ctx context.Context,
	rootID artifactstore.RootID,
) ([]Attachment, error)

func (*Service) Update

func (s *Service) Update(
	ctx context.Context,
	id artifactstore.RootID,
	update RootUpdate,
) (Root, error)

func (*Service) UpdateAttachment

func (s *Service) UpdateAttachment(
	ctx context.Context,
	rootID artifactstore.RootID,
	sourceID artifactstore.SourceID,
	update AttachmentUpdate,
) (Root, Attachment, error)

Jump to

Keyboard shortcuts

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