wysteria_common

package
Version: v0.0.0-...-301923a Latest Latest
Warning

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

Go to latest
Published: Dec 29, 2019 License: BSD-3-Clause Imports: 7 Imported by: 1

Documentation

Index

Constants

View Source
const (
	FacetRootCollection = "/"
	FacetCollection     = "collection"
	FacetItemType       = "itemtype"
	FacetItemVariant    = "variant"
	FacetLinkType       = "linktype"

	ValueLinkTypeItem    = "item"
	ValueLinkTypeVersion = "version"

	ErrorInvalid       = "invalid-input"      // the input was not valid
	ErrorAlreadyExists = "already-exists"     // the input object can't be created - it exists already
	ErrorIllegal       = "illegal-operation"  // the operation is not permitted
	ErrorNotFound      = "not-found"          // an explicitly given Id was not found
	ErrorNotServing    = "operation-rejected" // the server is not serving requests (ie. shutting down / maintenance)
)
View Source
const (
	RESERVED_NCS       byte = 0x80 //Reserved for NCS compatibility
	RFC_4122           byte = 0x40 //Specified in RFC 4122
	RESERVED_MICROSOFT byte = 0x20 //Reserved for Microsoft compatibility
	RESERVED_FUTURE    byte = 0x00 // Reserved for future definition.
)

Variables

This section is empty.

Functions

func ChooseClientConfig

func ChooseClientConfig() (string, error)

func ChooseServerConfig

func ChooseServerConfig() (string, error)

func NewId

func NewId(args ...interface{}) string

Create a new ID string deterministically

func ReadConfig

func ReadConfig(path string, conf interface{}) error

Read configuration information from a file

Types

type Collection

type Collection struct {
	Parent string            `json:"Parent"`
	Name   string            `json:"Name"`
	Id     string            `json:"Id"`
	Uri    string            `json:"Uri"`
	Facets map[string]string `json:"Facets"`
}

A collection is the highest level of object in wysteria. Each collection has a unique name and is used mostly to form logical groupings and help divide the search space for items into hopefully even-ish chunks.

func (*Collection) MarshalJSON

func (j *Collection) MarshalJSON() ([]byte, error)

MarshalJSON marshal bytes to json - template

func (*Collection) MarshalJSONBuf

func (j *Collection) MarshalJSONBuf(buf fflib.EncodingBuffer) error

MarshalJSONBuf marshal buff to json - template

func (*Collection) UnmarshalJSON

func (j *Collection) UnmarshalJSON(input []byte) error

UnmarshalJSON umarshall json - template of ffjson

func (*Collection) UnmarshalJSONFFLexer

func (j *Collection) UnmarshalJSONFFLexer(fs *fflib.FFLexer, state fflib.FFParseState) error

UnmarshalJSONFFLexer fast json unmarshall - template ffjson

type Item

type Item struct {
	Parent   string            `json:"Parent"`
	Id       string            `json:"Id"`
	Uri      string            `json:"Uri"`
	ItemType string            `json:"ItemType"`
	Variant  string            `json:"Variant"`
	Facets   map[string]string `json:"Facets"`
}

Items are the second tier of object in wysteria. Each has a parent collection denoted by the 'parent' field (the Id of a Collection). An 'Item' represents an abstract resource of a specific variant. For example different varieties of trees may all have type 'tree' and variants of 'oak' 'pine' etc. An Item doesn't refer to any particular version of something, rather it's the concept OF the thing independent of the specifics.

func (*Item) MarshalJSON

func (j *Item) MarshalJSON() ([]byte, error)

MarshalJSON marshal bytes to json - template

func (*Item) MarshalJSONBuf

func (j *Item) MarshalJSONBuf(buf fflib.EncodingBuffer) error

MarshalJSONBuf marshal buff to json - template

func (*Item) UnmarshalJSON

func (j *Item) UnmarshalJSON(input []byte) error

UnmarshalJSON umarshall json - template of ffjson

func (*Item) UnmarshalJSONFFLexer

func (j *Item) UnmarshalJSONFFLexer(fs *fflib.FFLexer, state fflib.FFParseState) error

UnmarshalJSONFFLexer fast json unmarshall - template ffjson

type Link struct {
	Name   string            `json:"Name"`
	Id     string            `json:"Id"`
	Uri    string            `json:"Uri"`
	Src    string            `json:"Src"`
	Dst    string            `json:"Dst"`
	Facets map[string]string `json:"Facets"`
}

A Link is an abstract named link "the thing of Id Src relates to the thing of Id Dst" The name is intended to convey the nature of the relationship.

func (*Link) MarshalJSON

func (j *Link) MarshalJSON() ([]byte, error)

MarshalJSON marshal bytes to json - template

func (*Link) MarshalJSONBuf

func (j *Link) MarshalJSONBuf(buf fflib.EncodingBuffer) error

MarshalJSONBuf marshal buff to json - template

func (*Link) UnmarshalJSON

func (j *Link) UnmarshalJSON(input []byte) error

UnmarshalJSON umarshall json - template of ffjson

func (*Link) UnmarshalJSONFFLexer

func (j *Link) UnmarshalJSONFFLexer(fs *fflib.FFLexer, state fflib.FFParseState) error

UnmarshalJSONFFLexer fast json unmarshall - template ffjson

type Marshalable

type Marshalable interface {
	MarshalJSON() ([]byte, error)
}

Interface for turning the struct into some byte representation. By default we're using ffjson to encode & later decode these but middleware needn't use this if they've got different requirements.

type QueryDesc

type QueryDesc struct {
	Parent        string
	Id            string
	Uri           string
	VersionNumber int32
	ItemType      string
	Variant       string
	Facets        map[string]string
	Name          string
	ResourceType  string
	Location      string
	LinkSrc       string
	LinkDst       string
}

A QueryDesc is a generic way to describe what one is searching for. Each field of a given QueryDesc is understood as an AND. Multiple QueryDesc's together are understood as an OR. That is, given a list of QueryDesc objects, results should be returned that match ALL of the fields (relevant to what you're search for) from at least one of the QueryDesc objects.

func (*QueryDesc) MarshalJSON

func (j *QueryDesc) MarshalJSON() ([]byte, error)

MarshalJSON marshal bytes to json - template

func (*QueryDesc) MarshalJSONBuf

func (j *QueryDesc) MarshalJSONBuf(buf fflib.EncodingBuffer) error

MarshalJSONBuf marshal buff to json - template

func (*QueryDesc) UnmarshalJSON

func (j *QueryDesc) UnmarshalJSON(input []byte) error

UnmarshalJSON umarshall json - template of ffjson

func (*QueryDesc) UnmarshalJSONFFLexer

func (j *QueryDesc) UnmarshalJSONFFLexer(fs *fflib.FFLexer, state fflib.FFParseState) error

UnmarshalJSONFFLexer fast json unmarshall - template ffjson

type Resource

type Resource struct {
	Parent       string            `json:"Parent"`
	Name         string            `json:"Name"`
	ResourceType string            `json:"ResourceType"`
	Id           string            `json:"Id"`
	Uri          string            `json:"Uri"`
	Location     string            `json:"Location"`
	Facets       map[string]string `json:"Facets"`
}

A Resource is a path to specific named URI with some type. The name string is intended to convey what the resource is or represents. The resource type string is intended to convey how the resource should be understood or used. Location is the actual URI to the resource For example, an image resource might have name:thumbnail type:url location:www.foo.com/bar.jpg

func (*Resource) MarshalJSON

func (j *Resource) MarshalJSON() ([]byte, error)

MarshalJSON marshal bytes to json - template

func (*Resource) MarshalJSONBuf

func (j *Resource) MarshalJSONBuf(buf fflib.EncodingBuffer) error

MarshalJSONBuf marshal buff to json - template

func (*Resource) UnmarshalJSON

func (j *Resource) UnmarshalJSON(input []byte) error

UnmarshalJSON umarshall json - template of ffjson

func (*Resource) UnmarshalJSONFFLexer

func (j *Resource) UnmarshalJSONFFLexer(fs *fflib.FFLexer, state fflib.FFParseState) error

UnmarshalJSONFFLexer fast json unmarshall - template ffjson

type UUID

type UUID [16]byte

func (UUID) String

func (u UUID) String() string

type Version

type Version struct {
	Parent string            `json:"Parent"`
	Id     string            `json:"Id"`
	Uri    string            `json:"Uri"`
	Number int32             `json:"Number"`
	Facets map[string]string `json:"Facets"`
}

Versions represent a specific version or iteration of an Item. That is, assuming you were designing a model for an oak tree (an Item) your first model would be attached to Version #1 of item Oak Tree. If you then made a better model, that would constitute Version #2 of item Oak Tree.

func (*Version) MarshalJSON

func (j *Version) MarshalJSON() ([]byte, error)

MarshalJSON marshal bytes to json - template

func (*Version) MarshalJSONBuf

func (j *Version) MarshalJSONBuf(buf fflib.EncodingBuffer) error

MarshalJSONBuf marshal buff to json - template

func (*Version) UnmarshalJSON

func (j *Version) UnmarshalJSON(input []byte) error

UnmarshalJSON umarshall json - template of ffjson

func (*Version) UnmarshalJSONFFLexer

func (j *Version) UnmarshalJSONFFLexer(fs *fflib.FFLexer, state fflib.FFParseState) error

UnmarshalJSONFFLexer fast json unmarshall - template ffjson

Directories

Path Synopsis
grpc_proto
Package wysteria_grpc is a generated protocol buffer package.
Package wysteria_grpc is a generated protocol buffer package.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
t or T : Toggle theme light dark auto
y or Y : Canonical URL