db

package
v0.0.0-...-3a06bfb Latest Latest
Warning

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

Go to latest
Published: Jan 6, 2024 License: Apache-2.0 Imports: 20 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AssetPathFor

func AssetPathFor(app core.App, fhash ref.FileHash) string

func DecodeAsset

func DecodeAsset(a *AssetModel, b []byte) error

func DecodeConfigModelData

func DecodeConfigModelData(encoded []byte) ([]byte, error)

func DecodeConfigModelSHA

func DecodeConfigModelSHA(encoded []byte) (ref.Sha256, error)

Types

type App

type App interface {
	core.App
	DB() *Service
}

type AssetModel

type AssetModel struct {
	Flag
	OID       ref.OID
	OriginOID ref.OID
	SHA       ref.Sha256
	DepSHA    ref.Sha256

	Created      ref.Time
	StepListData StepListData
	FHash        ref.FileHash
	Basename     string
	Url          string
	ExtData      []byte

	Tags []string
}

func New

func New(tx *Tx, oid []byte, opts ...AssetOpt) (*AssetModel, error)

func NewFromKV

func NewFromKV(tx *Tx, k, v []byte, opts ...AssetOpt) (*AssetModel, error)

func (*AssetModel) CompareCreated

func (a *AssetModel) CompareCreated(other *AssetModel) int

func (*AssetModel) Filename

func (a *AssetModel) Filename() string

type AssetModelInfo

type AssetModelInfo struct {
	Flag      Flag
	OriginOID ref.OID
	DepSHA    ref.Sha256
}

func DecodeAssetFast

func DecodeAssetFast(b []byte) (AssetModelInfo, error)

type AssetOpt

type AssetOpt func(tx *Tx, model *AssetModel) error

func WithTags

func WithTags() AssetOpt

type AssetRemover

type AssetRemover struct{}

func (AssetRemover) RemoveObject

func (r AssetRemover) RemoveObject(tx *Tx, model *AssetModel) error

type AssetTpl

type AssetTpl struct {
	Origin   *AssetModel
	TransSeq StepListTpl

	Basename string
	Url      string
	ExtData  []byte

	Content content.Content
	// contains filtered or unexported fields
}

func (AssetTpl) Create

func (template AssetTpl) Create() Task[*AssetModel]

type ConfigModel

type ConfigModel struct {
	OID ref.OID
	SHA
	Data
}

func DecodeConfigModel

func DecodeConfigModel(oid ref.OID, encoded []byte) (*ConfigModel, error)

type ConfigTpl

type ConfigTpl struct {
	O lazy.MustDataSHAObject
}

type Context

type Context interface {
	DB() *Service
	// contains filtered or unexported methods
}

type Cursor

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

func NewCursor

func NewCursor(cursor *bbolt.Cursor, seekTo []byte) *Cursor

func (*Cursor) Next

func (c *Cursor) Next() (r tipe.Result[util.KV])

type Data

type Data = lazy.ConstData

type Flag

type Flag uint8
const (
	HasOrigin Flag = 1 << iota
	SupportsRemove
)

func (Flag) HasOrigin

func (f Flag) HasOrigin() bool

type SHA

type SHA = lazy.ConstSHA

type Service

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

func Open

func Open(app core.App) (*Service, error)

func (Service) AssetPathFor

func (s Service) AssetPathFor(fhash ref.FileHash) string

func (*Service) Close

func (s *Service) Close() error

func (*Service) CreateFile

func (s *Service) CreateFile(tx *Tx, fhash ref.FileHash, r io.Reader) error

func (*Service) DB

func (s *Service) DB() *Service

func (*Service) RemoveFile

func (s *Service) RemoveFile(fhash ref.FileHash) error

func (*Service) RunR

func (s *Service) RunR(f func(*Tx) error) error

func (*Service) RunRW

func (s *Service) RunRW(f func(h *Tx) error) error

type Step

type Step struct {
	ConfigOID ref.OID
	Data      []byte
}

type StepList

type StepList []Step

type StepListData

type StepListData []byte

func (StepListData) Decode

func (d StepListData) Decode() StepList

type StepListTpl

type StepListTpl interface {
	MustSHA() ref.Sha256
	SupportsRemove() bool
	// contains filtered or unexported methods
}

func NewStepListTpl

func NewStepListTpl(list []*StepTpl, SupportsRemove bool) StepListTpl

type StepTpl

type StepTpl struct {
	Config ConfigTpl

	Params lazy.MustDataSHAObject
}

type Task

type Task[T any] func(*Tx) (T, error)

func AddTags

func AddTags(oid ref.OID, specs []tag.Spec) Task[[]string]

func TagByOid

func TagByOid(oid ref.OID) Task[[]string]

func (Task[T]) RunR

func (r Task[T]) RunR(ctx Context) (result T, err error)

func (Task[T]) RunRW

func (r Task[T]) RunRW(ctx Context) (result T, err error)

type Tx

type Tx struct {
	*bbolt.Tx
	// contains filtered or unexported fields
}

func (*Tx) AssetMetadata

func (tx *Tx) AssetMetadata() *internal.AssetMeta

func (*Tx) CONFIGS

func (tx *Tx) CONFIGS() *bbolt.Bucket

func (*Tx) C_SHA__OID

func (tx *Tx) C_SHA__OID() *bbolt.Bucket

func (*Tx) DB

func (tx *Tx) DB() *Service

func (*Tx) FILES

func (tx *Tx) FILES() *bbolt.Bucket

func (*Tx) F_BASENAME_OID

func (tx *Tx) F_BASENAME_OID() *bbolt.Bucket

func (*Tx) F_FHASH_OID

func (tx *Tx) F_FHASH_OID() *bbolt.Bucket

func (*Tx) F_FHASH_TSSHA__OID

func (tx *Tx) F_FHASH_TSSHA__OID() *bbolt.Bucket

func (*Tx) F_SHA__OID

func (tx *Tx) F_SHA__OID() *bbolt.Bucket

func (*Tx) F_URL_OID

func (tx *Tx) F_URL_OID() *bbolt.Bucket

func (*Tx) T_COID_FOID

func (tx *Tx) T_COID_FOID() *bbolt.Bucket

func (*Tx) T_FOID_TAG

func (tx *Tx) T_FOID_TAG() *bbolt.Bucket

func (*Tx) T_TAG__FOID

func (tx *Tx) T_TAG__FOID() *bbolt.Bucket

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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