space

package
v0.0.0-...-d2861cf Latest Latest
Warning

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

Go to latest
Published: Apr 29, 2018 License: MIT Imports: 17 Imported by: 1

Documentation

Index

Constants

View Source
const (
	SpaceInvalid = iota
	SpaceNoErrorMethod
	SpaceOperationFailed
)

Constants used for enumerating the generic error strings.

Variables

This section is empty.

Functions

func Get

func Get(ptp protocol.PointToPoint, tempFields ...interface{}) (t container.Tuple, b bool)

Get will open a TCP connection to the PointToPoint and send the message, which includes the type of operation and template specified by the user. The method returns a boolean to inform if the operation was carried out with any errors with communication.

func GetAgg

func GetAgg(ptp protocol.PointToPoint, fun interface{}, tempFields ...interface{}) (t container.Tuple, b bool)

GetAgg will connect to a space and aggregate on matched tuples from the space. This method is nonblocking and will return a tuple perfomed by the aggregation as well as a boolean state to denote if there were any errors with the communication. The resulting tuple is empty if no matching occurs or the aggregation function can not aggregate the matched tuples.

func GetAll

func GetAll(ptp protocol.PointToPoint, tempFields ...interface{}) (ts []container.Tuple, b bool)

GetAll will open a TCP connection to the PointToPoint and send the message, which includes the type of operation specified by the user. The method is nonblocking and will return all tuples found in the tuple space as well as a bool to denote if there were any errors with the communication.

func GetP

func GetP(ptp protocol.PointToPoint, tempFields ...interface{}) (container.Tuple, bool, bool)

GetP will open a TCP connection to the PointToPoint and send the message, which includes the type of operation and template specified by the user. The function will return two bool values. The first denotes if a tuple was found, the second if there were any erors with communication.

func NewSpaceError

func NewSpaceError(spc *Space, value interface{}, state interface{}) error

NewSpaceError creates a new error given space spc, a value used in an operation and the return state of the implemented operation. NewSpaceError returns a structure which fulfils the error interface and if an operation error has occured. NewSpaceError returns nil if no operation failure has occured.

func Put

func Put(ptp protocol.PointToPoint, tupleFields ...interface{}) (t container.Tuple, b bool)

Put will open a TCP connection to the PointToPoint and send the message, which includes the type of operation and tuple specified by the user. The method returns a boolean to inform if the operation was carried out with success or not.

func PutAgg

func PutAgg(ptp protocol.PointToPoint, fun interface{}, tempFields ...interface{}) (t container.Tuple, b bool)

PutAgg will connect to a space and aggregate on matched tuples from the space according to a template. This method is nonblocking and will return a tuple and boolean state to denote if there were any errors with the communication. The tuple returned is the aggregation of tuples in the space. If no tuples are found it will create and put a new tuple from the template itself.

func PutP

func PutP(ptp protocol.PointToPoint, tupleFields ...interface{}) (t container.Tuple, b bool)

PutP will open a TCP connection to the PointToPoint and send the message, which includes the type of operation and tuple specified by the user. As the method is nonblocking it wont wait for a response whether or not the operation was successful. The method returns a boolean to inform if the operation was carried out with any errors with communication.

func Query

func Query(ptp protocol.PointToPoint, tempFields ...interface{}) (t container.Tuple, b bool)

Query will open a TCP connection to the PointToPoint and send the message, which includes the type of operation and template specified by the user. The method returns a boolean to inform if the operation was carried out with any errors with communication.

func QueryAgg

func QueryAgg(ptp protocol.PointToPoint, fun interface{}, tempFields ...interface{}) (t container.Tuple, b bool)

QueryAgg will connect to a space and aggregated on matched tuples from the space. which includes the type of operation specified by the user. The method is nonblocking and will return a tuple found by aggregating the matched typles. The resulting tuple is empty if no matching occurs or the aggregation function can not aggregate the matched tuples.

func QueryAll

func QueryAll(ptp protocol.PointToPoint, tempFields ...interface{}) (ts []container.Tuple, b bool)

QueryAll will open a TCP connection to the PointToPoint and send the message, which includes the type of operation specified by the user. The method is nonblocking and will return all tuples found in the tuple space as well as a bool to denote if there were any errors with the communication.

func QueryP

func QueryP(ptp protocol.PointToPoint, tempFields ...interface{}) (container.Tuple, bool, bool)

QueryP will open a TCP connection to the PointToPoint and send the message, which includes the type of operation and template specified by the user. The function will return two bool values. The first denotes if a tuple was found, the second if there were any erors with communication.

func Size

func Size(ptp protocol.PointToPoint) (sz int, b bool)

Size will open a TCP connection to the PointToPoint and request the size of the tuple space.

Types

type Intercellestial

type Intercellestial interface {
	RawPutAgg(function interface{}, template ...interface{}) (interface{}, interface{})
	RawGetAgg(function interface{}, template ...interface{}) (interface{}, interface{})
	RawQueryAgg(function interface{}, template ...interface{}) (interface{}, interface{})
}

Intercellestial defines the internal space aggregation interface without any error checking. Intercellestial interface is meant primarily for internal usage. This interface can change without any notice.

type Interspace

type Interspace interface {
	Put(tuple ...interface{}) (container.Tuple, error)
	Get(template ...interface{}) (container.Tuple, error)
	Query(template ...interface{}) (container.Tuple, error)
	PutP(tuple ...interface{}) (container.Tuple, error)
	GetP(template ...interface{}) (container.Tuple, error)
	QueryP(template ...interface{}) (container.Tuple, error)
	GetAll(template ...interface{}) ([]container.Tuple, error)
	QueryAll(template ...interface{}) ([]container.Tuple, error)
}

Interspace defines the internal space interface. Interspace interface is meant to be used by both external or internal interfaces.

type Interstar

type Interstar interface {
	PutAgg(function interface{}, template ...interface{}) (container.Tuple, error)
	GetAgg(function interface{}, template ...interface{}) (container.Tuple, error)
	QueryAgg(function interface{}, template ...interface{}) (container.Tuple, error)
}

Interstar defines the internal space aggregation interface. Interstar interface is meant to be used by both external or internal interfaces.

type Interstellar

type Interstellar interface {
	RawPut(tuple ...interface{}) (interface{}, interface{})
	RawGet(template ...interface{}) (interface{}, interface{})
	RawQuery(template ...interface{}) (interface{}, interface{})
	RawPutP(tuple ...interface{}) (interface{}, interface{})
	RawGetP(template ...interface{}) (interface{}, interface{})
	RawQueryP(template ...interface{}) (interface{}, interface{})
	RawGetAll(template ...interface{}) (interface{}, interface{})
	RawQueryAll(template ...interface{}) (interface{}, interface{})
}

Interstellar defines the internal space interface without any error checking. Interstellar interface is meant primarily for internal usage. This interface can change without any notice.

type Space

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

Space is a structure for interacting with a space.

func NewRemoteSpace

func NewRemoteSpace(url string) (rs Space)

NewRemoteSpace connects to a remote space rs with the specified URL.

func NewSpace

func NewSpace(url string, cp ...*policy.Composable) (s Space)

NewSpace creates an empty space s with the specified URL.

func (*Space) Get

func (s *Space) Get(t ...interface{}) (tp container.Tuple, e error)

Get performs a blocking retrieval for a tuple from space s with template t. Get returns the matched tuple tp and an error e. Error e contains a structure adhering to the error interface if the operation fails, and nil if no error occured.

func (*Space) GetAgg

func (s *Space) GetAgg(f interface{}, t ...interface{}) (tp container.Tuple, e error)

GetAgg performs a non-blocking aggregation retrieval on all tuples from space s that matches template t. GetAgg uses an aggregation function f to aggregate a pair of tuples into one. GetAgg returns an aggregate tuple tp and an error e. Error e contains a structure adhering to the error interface if the operation fails, and nil if no error occured.

func (*Space) GetAll

func (s *Space) GetAll(t ...interface{}) (ts []container.Tuple, e error)

GetAll performs a non-blocking retrieval for all tuples from space s with template t. GetAll returns the matching tuples ts and an error e. Error e contains a structure adhering to the error interface if the operation fails, and nil if no error occured.

func (*Space) GetP

func (s *Space) GetP(t ...interface{}) (tp container.Tuple, e error)

GetP performs a non-blocking retrieval for a tuple from space s with template t. GetP returns the matched tuple tp and an error e. Error e contains a structure adhering to the error interface if the operation fails, and nil if no error occured.

func (*Space) ID

func (s *Space) ID() (id string, e error)

ID returns the identifier for space s. Error e contains a structure adhering to the error interface if the operation fails, and nil if no error occured.

func (*Space) InterpretError

func (s *Space) InterpretError(state interface{}) (msg string)

InterpretError returns an error message msg given a return state by an operation. The state is given by the implementation and this method maps from the state to sane error messages. This is an internal method and may change without notice.

func (*Space) InterpretOperation

func (s *Space) InterpretOperation(state interface{}) (status bool)

InterpretOperation returns a status for an operation that has been succesful given a return state by an operation. The state is given by the implementation and this method maps the returned state to a boolean value. This is an internal method and may change without notice.

func (*Space) InterpretValue

func (s *Space) InterpretValue(value interface{}) (str string)

InterpretValue returns a representation of the value that was passed to the operation. The representation for now is a print friendly string value. This is an internal method and may change without notice.

func (*Space) Put

func (s *Space) Put(t ...interface{}) (tp container.Tuple, e error)

Put performs a blocking placement a tuple t into space s. Put returns the original tuple tp and an error e. Error e contains a structure adhering to the error interface if the operation fails, and nil if no error occured.

func (*Space) PutAgg

func (s *Space) PutAgg(f interface{}, t ...interface{}) (tp container.Tuple, e error)

PutAgg performs a non-blocking aggregation placement on all tuples from space s that matches template t. PutAgg uses an aggregation function f to aggregate a pair of tuples into one. PutAgg places either the aggregate tuple, or the intrinsic tuple belonging to a template t if no matching tuples are returned, back into s. PutAgg returns either the aggregate or intrinsic tuple and an error e. Error e contains a structure adhering to the error interface if the operation fails, and nil if no error occured.

func (*Space) PutP

func (s *Space) PutP(t ...interface{}) (tp container.Tuple, e error)

PutP performs a non-blocking placement a tuple t into space s. PutP returns the original tuple tp and an error e. Error e contains a structure adhering to the error interface if the operation fails, and nil if no error occured.

func (*Space) Query

func (s *Space) Query(t ...interface{}) (tp container.Tuple, e error)

Query performs a blocking query for a tuple from space s with template t. Query returns the matched tuple tp and an error e. Error e contains a structure adhering to the error interface if the operation fails, and nil if no error occured.

func (*Space) QueryAgg

func (s *Space) QueryAgg(f interface{}, t ...interface{}) (tp container.Tuple, e error)

QueryAgg performs a non-blocking aggregation query on all tuples from space s that matches template t. QueryAgg uses an aggregation function f to aggregate a pair of tuples into one. QueryAgg returns an aggregate tuple tp and an error e. Error e contains a structure adhering to the error interface if the operation fails, and nil if no error occured.

func (*Space) QueryAll

func (s *Space) QueryAll(t ...interface{}) (ts []container.Tuple, e error)

QueryAll performs a non-blocking query for all tuples from space s with template t. QueryAll returns the matching tuples ts and an error e. Error e contains a structure adhering to the error interface if the operation fails, and nil if no error occured.

func (*Space) QueryP

func (s *Space) QueryP(t ...interface{}) (tp container.Tuple, e error)

QueryP performs a non-blocking query for a tuple from space s with template t. QueryP returns the matched tuple tp and an error e. Error e contains a structure adhering to the error interface if the operation fails, and nil if no error occured.

func (*Space) RawGet

func (s *Space) RawGet(t ...interface{}) (tp interface{}, e interface{})

RawGet performs a blocking retrieval a tuple from space s with template t and without any error checking. RawGet returns the implementation result tp and error state e.

func (*Space) RawGetAgg

func (s *Space) RawGetAgg(f interface{}, t ...interface{}) (tp interface{}, e interface{})

RawGetAgg performs a non-blocking aggregation retrieval on all tuples from space that match template t and without any error checking. RawGetAgg uses an aggregation function f to aggregate a pair of tuples into one. RawGetAgg returns the implementation result tp and error state e.

func (*Space) RawGetAll

func (s *Space) RawGetAll(t ...interface{}) (ts interface{}, e interface{})

RawGetAll performs a non-blocking retrieval for all tuples from space s with template t and without any error checking. RawGetAll returns the implementation result ts and error state e.

func (*Space) RawGetP

func (s *Space) RawGetP(t ...interface{}) (tp interface{}, e interface{})

RawGetP performs a non-blocking retrieval a tuple from space s with template t and without any error checking. RawGetP returns the implementation result tp and error state e.

func (*Space) RawPut

func (s *Space) RawPut(t ...interface{}) (tp interface{}, e interface{})

RawPut performs a blocking placement of a tuple t into space s without any error checking. RawPut returns the implementation result tp and error state e.

func (*Space) RawPutAgg

func (s *Space) RawPutAgg(f interface{}, t ...interface{}) (tp interface{}, e interface{})

RawPutAgg performs a non-blocking aggregation retrieval on all tuples from space that match template t and without any error checking. RawPutAgg uses an aggregation function f to aggregate a pair of tuples into one. RawPutAgg returns the implementation result tp and error state e.

func (*Space) RawPutP

func (s *Space) RawPutP(t ...interface{}) (tp interface{}, e interface{})

RawPutP performs a non-blocking placement of a tuple t into space s without any error checking. RawPutP returns the implementation result tp and error state e.

func (*Space) RawQuery

func (s *Space) RawQuery(t ...interface{}) (tp interface{}, e interface{})

RawQuery performs a blocking query for a tuple from space s with template t and without any error checking. RawQuery returns the implementation result tp and error state e.

func (*Space) RawQueryAgg

func (s *Space) RawQueryAgg(f interface{}, t ...interface{}) (tp interface{}, e interface{})

RawQueryAgg performs a non-blocking aggregation query on all tuples from space that match template t and without any error checking. RawQueryAgg uses an aggregation function f to aggregate a pair of tuples into one. RawQueryAgg returns the implementation result tp and error state e.

func (*Space) RawQueryAll

func (s *Space) RawQueryAll(t ...interface{}) (ts interface{}, e interface{})

RawQueryAll performs a non-blocking query for all tuples from space s with template t and without any error checking. RawQueryAll returns the implementation result ts and error state e.

func (*Space) RawQueryP

func (s *Space) RawQueryP(t ...interface{}) (tp interface{}, e interface{})

RawQueryP performs a blocking query for a tuple from space s with template t and without any error checking. RawQueryP returns the implementation result tp and error state e.

func (*Space) RawSize

func (s *Space) RawSize() (sz interface{}, e interface{})

RawSize retrieves the size of space s at this instant without any error checking. RawSize returns the implementation result sz and error state e.

func (*Space) Size

func (s *Space) Size() (sz int, e error)

Size retrieves the size of space s at this instant. Size returns the space size or -1 if it was not possible to determine the size at this instant. Error e contains a structure adhering to the error interface if the operation fails, and nil if no error occured.

type SpaceError

type SpaceError struct {
	Msg     string
	LibInfo function.CallerInfo
	UsrInfo function.CallerInfo
	Sid     string
	Val     string
	Sop     bool
	Status  interface{}
}

SpaceError represents an internal error type used when printing error messages.

func (SpaceError) Error

func (e SpaceError) Error() (s string)

Error prints the error message s represented by SpaceError e.

func (SpaceError) Operation

func (e SpaceError) Operation() bool

Operation returns a boolean value if an operation has succeeded.

type TupleSpace

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

TupleSpace contains a set of tuples and it has a mutex lock associated with it to secure mutual exclusion. Furthermore a port number to locate it.

func CreateTupleSpace

func CreateTupleSpace(port int) (ts *TupleSpace)

CreateTupleSpace creates a new tuple space.

func NewRemoteSpaceAlt

func NewRemoteSpaceAlt(url string, cp ...*policy.Composable) (ptp *protocol.PointToPoint, ts *TupleSpace)

NewRemoteSpaceAlt creates a remote representation of a tuple space.

func NewSpaceAlt

func NewSpaceAlt(url string, cp ...*policy.Composable) (ptp *protocol.PointToPoint, ts *TupleSpace)

NewSpaceAlt creates a representation of a new tuple space.

func (*TupleSpace) Listen

func (ts *TupleSpace) Listen()

Listen will listen and accept all incoming connections. Once a connection has been established, the connection is passed on to the handler.

func (*TupleSpace) Size

func (ts *TupleSpace) Size() int

Size return the number of tuples in the tuple space.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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