models

package
v2.0.0-...-6b45633 Latest Latest
Warning

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

Go to latest
Published: Jul 6, 2023 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Collection

type Collection struct {
	CollectionID    int64
	EstateID        int64
	Name            string
	Description     string
	SignaturePrefix string
	StorageID       int64
	JWTKey          string
	Secret          string
	Public          any
}

type Collections

type Collections struct {
	*Pool
	sync.RWMutex
	// contains filtered or unexported fields
}

func NewCollections

func NewCollections(p *Pool, db CollectionsDatabase) (*Collections, error)

func (*Collections) Add

func (cols *Collections) Add(coll *Collection)

func (*Collections) Clear

func (cols *Collections) Clear()

func (*Collections) Get

func (cols *Collections) Get(name string) (*Collection, error)

type CollectionsDatabase

type CollectionsDatabase interface {
	CollectionsLoadAll(colls *Collections) error
}

type Item

type Item struct {
	ItemID        int64
	CollectionID  int64
	Signature     string
	Urn           string
	Type          string
	SubType       string
	ObjectType    string
	ParentID      int64
	Mimetype      string
	Error         string
	SHA512        string
	Metadata      string
	CreationDate  time.Time
	LastModified  time.Time
	Disbled       bool
	Public        bool
	PublicActions []string
	Status        string
}

type Items

type Items struct {
	*Pool
	// contains filtered or unexported fields
}

func NewItems

func NewItems(p *Pool, db ItemsDatabase, cacheSize int, cacheExpiration time.Duration) (*Items, error)

func (*Items) Load

func (items *Items) Load(collection, signature string) (*Item, error)

type ItemsDatabase

type ItemsDatabase interface {
	LoadItem(collection string, signature string) (*Item, error)
}

type Pool

type Pool struct {
	Storages    *Storages
	Collections *Collections
	Items       *Items
}

func NewPool

func NewPool(
	collectionsDatabase CollectionsDatabase,
	storagesDatabase StoragesDatabase,
	itemsDatabase ItemsDatabase,
	itemsCacheSize int,
	itemsCacheExpiration time.Duration,
) (*Pool, error)

type Storage

type Storage struct {
	StorageID  int64
	Name       string
	FileBase   string
	DataDir    string
	SubItemDir string
	TempDir    string
}

type Storages

type Storages struct {
	*Pool
	sync.RWMutex
	// contains filtered or unexported fields
}

func NewStorages

func NewStorages(p *Pool, db StoragesDatabase) (*Storages, error)

func (*Storages) Add

func (stors *Storages) Add(stor *Storage)

func (*Storages) Clear

func (stors *Storages) Clear()

func (*Storages) Get

func (stors *Storages) Get(name string) (*Storage, error)

type StoragesDatabase

type StoragesDatabase interface {
	StoragesLoadAll(stors *Storages) error
}

Jump to

Keyboard shortcuts

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