entities

package
v0.0.6-alpha.1 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrEmptyReferencesSlice = errors.New("entity/aggregate-root: empty references slice")
)

Functions

This section is empty.

Types

type AggregateRoot

type AggregateRoot struct {
	References         []KeyValueEntity `yaml:"-" json:"-"`
	ReferencePartition string           `yaml:"-" json:"-"`
	Root               KeyValueEntity   `yaml:"-" json:"-"`
	RootPartition      string           `yaml:"-" json:"-"`
}

Aggretate root used to manage key/value entity relationships

func NewAggregateRoot

func NewAggregateRoot(
	root KeyValueEntity,
	rootPartition string,
	references []KeyValueEntity,
	referencesPartition string) (*AggregateRoot, error)

Create a new key/value aggregate root

func (*AggregateRoot) EntityIDs

func (aggregate *AggregateRoot) EntityIDs() []uint64

Returns a list of the referenced entity ids

func (*AggregateRoot) Partition

func (aggregate *AggregateRoot) Partition() string

Returns the aggregate root partition

type BIOS

type BIOS struct {
	Date    string `yaml:"date" json:"date"`
	Release string `yaml:"release" json:"release"`
	Vendor  string `yaml:"vendor" json:"vendor"`
	Version string `yaml:"version" json:"version"`
}

func (BIOS) Print

func (b BIOS) Print()

type Blob

type Blob struct {
	ID     uint64      `yaml:"id" json:"id"`
	Bytes  []byte      `yaml:"bytes" json:"bytes"`
	Entity interface{} `yaml:"entity" json:"entity"`

	KeyValueEntity `yaml:"-" json:"-"`
	// contains filtered or unexported fields
}

func CreateBlob

func CreateBlob(id uint64, bytes []byte, partition string) *Blob

func NewBlob

func NewBlob(id uint64, bytes []byte) *Blob

func (*Blob) EntityID

func (blob *Blob) EntityID() uint64

func (*Blob) Partition

func (blob *Blob) Partition() string

func (*Blob) SetEntity

func (blob *Blob) SetEntity(entity interface{})

func (*Blob) SetEntityID

func (blob *Blob) SetEntityID(id uint64)

func (*Blob) SetPartition

func (blob *Blob) SetPartition(partition string)

type Board

type Board struct {
	AssetTag string `yaml:"asset-tag" json:"asset_tag"`
	Name     string `yaml:"name" json:"name"`
	Serial   string `yaml:"serial" json:"serial"`
	Vendor   string `yaml:"vendor" json:"vendor"`
	Version  string `yaml:"version" json:"version"`
}

func (Board) Print

func (b Board) Print()

type CPUInfo

type CPUInfo struct {
	ModelName string   `yaml:"model" json:"model"`
	Cores     int      `yaml:"cores" json:"cores"`
	CacheSize string   `yaml:"cache" json:"cache"`
	Flags     []string `yaml:"flags" json:"flags"`
	Threads   int      `yaml:"threads" json:"threads"`
}

func (CPUInfo) Print

func (c CPUInfo) Print()

type Chassis

type Chassis struct {
	AssetTag string `yaml:"asset-tag" json:"asset_tag"`
	Serial   string `yaml:"serial" json:"serial"`
	Type     string `yaml:"type" json:"type"`
	Vendor   string `yaml:"vendor" json:"vendor"`
	Version  string `yaml:"version" json:"version"`
}

func (Chassis) Print

func (c Chassis) Print()

type Index

type Index interface {
	Name() string
	RefID() uint64
	KeyValueEntity
}

func NewReference

func NewReference(name string, referenceID uint64, referencedValue []byte) Index

type KeyValueEntity

type KeyValueEntity interface {
	SetEntityID(id uint64)
	EntityID() uint64
}

type Organization

type Organization struct {
	ID             uint64 `yaml:"id" json:"id"`
	Name           string `yaml:"name" json:"name"`
	KeyValueEntity `yaml:"-" json:"-"`
}

func NewOrganization

func NewOrganization(name string) *Organization

func (*Organization) EntityID

func (organization *Organization) EntityID() uint64

func (*Organization) SetEntityID

func (organization *Organization) SetEntityID(id uint64)

type Product

type Product struct {
	Family  string `yaml:"family" json:"family"`
	Name    string `yaml:"name" json:"name"`
	Serial  string `yaml:"serial" json:"serial"`
	SKU     string `yaml:"sku" json:"sku"`
	UUID    string `yaml:"uuid" json:"uuid"`
	Version string `yaml:"version" json:"version"`
}

func (Product) Print

func (p Product) Print()

type Reference

type Reference struct {
	ID          uint64 `yaml:"id" json:"id"`
	ReferenceID uint64 `yaml:"ref-id" json:"ref_id"`

	Index `yaml:"-" json:"-"`
	// contains filtered or unexported fields
}

func (*Reference) EntityID

func (ref *Reference) EntityID() uint64

func (*Reference) Name

func (ref *Reference) Name() string

func (*Reference) RefID

func (ref *Reference) RefID() uint64

func (*Reference) SetEntityID

func (ref *Reference) SetEntityID(id uint64)

type Registration

type Registration struct {
	ID             uint64 `yaml:"id" json:"id"`
	Email          string `yaml:"email" json:"email"`
	Password       string `yaml:"password" json:"password"`
	OrgID          uint64 `yaml:"org-id" json:"org_id"`
	OrgName        string `yaml:"org-name" json:"org_name"`
	SessionData    []byte `yaml:"session-data" json:"session_data"`
	KeyValueEntity `yaml:"-" json:"-"`
}

func NewRegistration

func NewRegistration(email string) *Registration

func (*Registration) EntityID

func (r *Registration) EntityID() uint64

func (*Registration) SetEntityID

func (r *Registration) SetEntityID(id uint64)

type Role

type Role struct {
	ID             uint64 `json:"id"`
	Name           string `json:"name"`
	KeyValueEntity `yaml:"-" json:"-"`
}

func NewRole

func NewRole(name string) *Role

func (*Role) EntityID

func (role *Role) EntityID() uint64

func (*Role) SetEntityID

func (role *Role) SetEntityID(id uint64)

type Service

type Service struct {
	ID            uint64
	Name          string
	KeyAttributes *keystore.KeyAttributes
}

func NewService

func NewService(name string) *Service

func (*Service) EntityID

func (service *Service) EntityID() uint64

func (*Service) SetEntityID

func (service *Service) SetEntityID(id uint64)

type System

type System struct {
	BIOS     *BIOS          `yaml:"bios" json:"bios,omitempty"`
	Board    *Board         `yaml:"board" json:"board,omitempty"`
	Chassis  *Chassis       `yaml:"chassis" json:"chassis,omitempty"`
	CPU      *CPUInfo       `yaml:"cpu" json:"cpu"`
	Mode     string         `yaml:"mode" json:"mode"`
	Product  *Product       `yaml:"product" json:"product"`
	Runtime  *SystemRuntime `yaml:"runtime" json:"runtime"`
	Services int            `yaml:"services" json:"services"`
}

type SystemRuntime

type SystemRuntime struct {
	Version     string `yaml:"version" json:"version"`
	Goroutines  int    `yaml:"goroutines" json:"goroutines"`
	Cpus        int    `yaml:"cpus" json:"cpus"`
	Cgo         int64  `yaml:"cgo" json:"cgo"`
	HeapSize    uint64 `yaml:"heap-alloc" json:"heapAlloc"`
	Alloc       uint64 `yaml:"alloc" json:"alloc"`
	Sys         uint64 `yaml:"sys" json:"sys"`
	Mallocs     uint64 `yaml:"mallocs" json:"mallocs"`
	Frees       uint64 `yaml:"frees" json:"frees"`
	NumGC       uint32 `yaml:"gc" json:"gc"`
	NumForcedGC uint32 `yaml:"num-forced-gc" json:"numForcedGC"`
}

func (SystemRuntime) Print

func (sr SystemRuntime) Print()

type TimeSeriesIndexer

type TimeSeriesIndexer interface {
	KeyValueEntity
	SetTimestamp(timestamp uint64)
	Timestamp() uint64
}

type User

type User struct {
	ID               uint64                `yaml:"id" json:"id"`
	Credentials      []webauthn.Credential `yaml:"credentials" json:"credentials"`
	DisplayName      string                `yaml:"display" json:"display"`
	Email            string                `yaml:"email" json:"email"`
	OrganizationRefs []uint64              `yaml:"orgs" json:"orgs"`
	Password         string                `yaml:"password" json:"password"`
	Roles            []*Role               `yaml:"roles" json:"roles"`
	ServiceRefs      []uint64              `yaml:"services" json:"services"`
	SessionData      []byte                `yaml:"session" json:"session"`
	KeyValueEntity   `yaml:"-" json:"-"`
	webauthn.User    `yaml:"-" json:"-"`
}

func NewUser

func NewUser(email string) *User

func (*User) AddCredential

func (user *User) AddCredential(credential *webauthn.Credential)

Adds a new WebAuthn credential

func (*User) AddRole

func (user *User) AddRole(role *Role)

func (*User) EntityID

func (user *User) EntityID() uint64

func (*User) HasRole

func (user *User) HasRole(name string) bool

func (*User) SetEntityID

func (user *User) SetEntityID(id uint64)

func (*User) UpdateCredential

func (user *User) UpdateCredential(credential *webauthn.Credential)

func (*User) WebAuthnCredentials

func (user *User) WebAuthnCredentials() []webauthn.Credential

WebAuthnCredentials provides the list of Credential objects owned by the user.

func (*User) WebAuthnDisplayName

func (user *User) WebAuthnDisplayName() string

Specification: §5.4.3. User Account Parameters for Credential Generation https://www.w3.org/TR/webauthn/#dom-publickeycredentialuserentity-displayname

func (*User) WebAuthnID

func (user *User) WebAuthnID() []byte

Specification: §5.4.3. User Account Parameters for Credential Generation https://w3c.github.io/webauthn/#dom-publickeycredentialuserentity-id

func (*User) WebAuthnName

func (user *User) WebAuthnName() string

Specification: §5.4.3. User Account Parameters for Credential Generation https://w3c.github.io/webauthn/#dictdef-publickeycredentialuserentity

Jump to

Keyboard shortcuts

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