model

package
v0.0.0-...-21946b5 Latest Latest
Warning

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

Go to latest
Published: Dec 6, 2018 License: Apache-2.0 Imports: 1 Imported by: 13

Documentation

Index

Constants

View Source
const (
	ActorAttribute = "actor"
	ActorConsumer  = "consumer"
	ActorAdmin     = "admin"
)

Available actor type

View Source
const (
	ObjectTypeAdmin            = "admin"
	ObjectTypeConsumer         = "consumer"
	ObjectTypeResource         = "resource"
	ObjectTypeResourcesDeleted = "resources-deleted"
)

List of object type stored in the ledger

View Source
const (
	ResourcesFilterAll             = "all"
	ResourcesFilterOnlyAvailable   = "only-available"
	ResourcesFilterOnlyUnavailable = "only-unavailable"
)

List of available filter for query resources

Variables

This section is empty.

Functions

This section is empty.

Types

type Actor

type Actor struct {
	ID   string `json:"id"`
	Name string `json:"name"`
}

Actor metadata used for an admin and a consumer

type Admin

type Admin struct {
	Actor
}

Admin that manage resources available

type Consumer

type Consumer struct {
	Actor
}

Consumer that acquire and release some resources

type Resource

type Resource struct {
	ID          string `json:"id"`
	Description string `json:"description"`
	Available   bool   `json:"available"`
	Mission     string `json:"mission,omitempty"`
	Consumer    string `json:"consumer,omitempty"`
}

Resource that is manage by an admin actor and can be acquire and release by a consumer

type ResourceHistories

type ResourceHistories []ResourceHistory

ResourceHistories the list of state in the ledger of a resource (with sorting, older at the end)

func (ResourceHistories) Len

func (a ResourceHistories) Len() int

func (ResourceHistories) Less

func (a ResourceHistories) Less(i, j int) bool

func (ResourceHistories) Swap

func (a ResourceHistories) Swap(i, j int)

type ResourceHistory

type ResourceHistory struct {
	Transaction string    `json:"transaction"`
	Resource    Resource  `json:"value"`
	Time        time.Time `json:"time"`
	Deleted     bool      `json:"deleted"`
}

ResourceHistory is a detailed information about a resource state in the ledger

type ResourcesDeleted

type ResourcesDeleted []Resource

ResourcesDeleted list of resources deleted

Jump to

Keyboard shortcuts

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