shared

package
v0.0.0-...-59fb8d1 Latest Latest
Warning

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

Go to latest
Published: Jan 7, 2021 License: MIT Imports: 5 Imported by: 3

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Intertemplate

type Intertemplate interface {
	Length() int
	GetFieldAt(i int) interface{}
	NewTuple() Tuple
}

Intertemplate an interface for manipulating templates.

type Intertuple

type Intertuple interface {
	Length() int
	GetFieldAt(i int) interface{}
	SetFieldAt(i int, val interface{})
}

Intertuple defines an interface for manipulating tuples.

type Mode

type Mode int

Mode defines the connection mode to a resource.

const (
	ConnKeep Mode = iota
	ConnOnce
	ConnPush
	ConnPull
)

type SpaceURI

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

SpaceURI is a structure for containing information about a resource location.

func NewSpaceURI

func NewSpaceURI(rawurl string) (su *SpaceURI, e error)

NewSpaceURI creates a new URI location to a resource. NewSpaceURI follows a restricted URI scheme defined by pSpace specification.

func (*SpaceURI) Hostname

func (su *SpaceURI) Hostname() (hostname string)

Hostname returns the hostname contained in the URI.

func (*SpaceURI) Mode

func (su *SpaceURI) Mode() (mode string)

Mode returns the connection mode contained in the URI.

func (*SpaceURI) Path

func (su *SpaceURI) Path() (path string)

Path returns the path contained in the URI.

func (*SpaceURI) Port

func (su *SpaceURI) Port() (port string)

Port returns the port contained in the URI.

func (*SpaceURI) Scheme

func (su *SpaceURI) Scheme() (hostname string)

Scheme returns the scheme contained in the URI.

func (*SpaceURI) Space

func (su *SpaceURI) Space() (hostname string)

Space returns the space name contained in the URI.

func (SpaceURI) String

func (su SpaceURI) String() (str string)

String returns a print friendly representation of the URI.

type Template

type Template struct {
	Fields []interface{}
}

Template structure used for matching against tuples. Templates is, in princple, a tuple with additional attributes used for pattern matching.

func CreateTemplate

func CreateTemplate(fields ...interface{}) Template

CreateTemplate creates a template from the variadic fields provided. CreateTemplate encapsulates the types of pointer values and are used to provide variable binding. Variable binding is used in Pattern matched values such that they can be writen back through the pointers.

func (Template) GetDelimiter

func (tp Template) GetDelimiter() string

GetDelimiter returns the delimiter used to seperated the template fields. GetParenthesisType is used in the String() method.

func (*Template) GetFieldAt

func (tp *Template) GetFieldAt(i int) interface{}

GetFieldAt returns the i'th field of the template.

func (Template) GetParenthesisType

func (tp Template) GetParenthesisType() (string, string)

GetParenthesisType returns a pair of strings that encapsulates the template. GetParenthesisType is used in the String() method.

func (*Template) Length

func (tp *Template) Length() int

Length returns the amount of fields of the template.

func (*Template) NewTuple

func (tp *Template) NewTuple() (t Tuple)

NewTuple returns a new tuple t from the template. NewTuple initializes all tuple fields in t with empty values depending on types in the template.

func (Template) String

func (tp Template) String() string

String returns a print friendly representation of the template.

type Tuple

type Tuple struct {
	Fields []interface{} // Field of the tuple.
}

Tuple contains a set of fields, where fields can be any primitive or type. A tuple is used to store information which is placed in a tuple space.

func CreateTuple

func CreateTuple(fields ...interface{}) Tuple

CreateTuple create a tuple according to the values in the fields.

func CreateTupleFromTemplate

func CreateTupleFromTemplate(t ...interface{}) (tp Tuple)

CreateTupleFromTemplate reads a template and returns a new tuple tp. CreateTupleFromTemplate extracts values from any pointers it finds in template t.

func (Tuple) GetDelimiter

func (t Tuple) GetDelimiter() string

GetDelimiter returns the delimiter used to seperated the tuple fields. GetParenthesisType is used in the String() method.

func (*Tuple) GetFieldAt

func (t *Tuple) GetFieldAt(i int) interface{}

GetFieldAt returns the i'th field of the tuple.

func (Tuple) GetParenthesisType

func (t Tuple) GetParenthesisType() (string, string)

GetParenthesisType returns a pair of strings that encapsulates the tuple. GetParenthesisType is used in the String() method.

func (*Tuple) Length

func (t *Tuple) Length() int

Length returns the amount of fields of the tuple.

func (*Tuple) Match

func (t *Tuple) Match(tp Template) bool

Match pattern matches the tuple against the template tp. Match discriminates between encapsulated formal fields and actual fields. Match returns true if the template matches the tuple, and false otherwise.

func (*Tuple) SetFieldAt

func (t *Tuple) SetFieldAt(i int, val interface{})

SetFieldAt sets the i'th field of the tuple to the value of val.

func (Tuple) String

func (t Tuple) String() string

String returns a print friendly representation of the tuple.

func (*Tuple) WriteToVariables

func (t *Tuple) WriteToVariables(params ...interface{})

WriteToVariables will overwrite the values pointed to by pointers with the values contained in the tuple. WriteToVariables will ignore unaddressable pointers. TODO: There should be placed a lock around the variables that are being changed, to ensure that mix of two tuple are written to the variables.

type TypeField

type TypeField struct {
	TypeStr string
}

TypeField encapsulate a type.

func CreateTypeField

func CreateTypeField(t reflect.Type) TypeField

CreateTypeField creates an encapsulation of a type.

func (TypeField) GetType

func (tf TypeField) GetType() reflect.Type

GetType returns a type associated to this Typefield.

func (TypeField) String

func (tf TypeField) String() string

String returns the type string of this TypeField.

Jump to

Keyboard shortcuts

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