Documentation ¶
Index ¶
- Constants
- func Get(ptp PointToPoint, tempFields ...interface{}) bool
- func GetAll(ptp PointToPoint, tempFields ...interface{}) ([]Tuple, bool)
- func GetP(ptp PointToPoint, tempFields ...interface{}) (bool, bool)
- func NewRemoteSpaceAlt(url string) (ptp *PointToPoint, ts *TupleSpace)
- func NewSpaceAlt(url string) (ptp *PointToPoint, ts *TupleSpace)
- func NewSpaceError(spc *Space, value interface{}, state interface{}) error
- func Put(ptp PointToPoint, tupleFields ...interface{}) bool
- func PutP(ptp PointToPoint, tupleFields ...interface{}) bool
- func Query(ptp PointToPoint, tempFields ...interface{}) bool
- func QueryAll(ptp PointToPoint, tempFields ...interface{}) ([]Tuple, bool)
- func QueryP(ptp PointToPoint, tempFields ...interface{}) (bool, bool)
- type Interspace
- type Interstellar
- type Space
- func (s *Space) Get(t ...interface{}) (tp Tuple, e error)
- func (s *Space) GetAll(t ...interface{}) (ts []Tuple, e error)
- func (s *Space) GetP(t ...interface{}) (tp Tuple, e error)
- func (s *Space) InterpretError(state interface{}) (msg string)
- func (s *Space) InterpretOperation(state interface{}) (status bool)
- func (s *Space) InterpretValue(value interface{}) (str string)
- func (s *Space) Put(t ...interface{}) (tp Tuple, e error)
- func (s *Space) PutP(t ...interface{}) (tp Tuple, e error)
- func (s *Space) Query(t ...interface{}) (tp Tuple, e error)
- func (s *Space) QueryAll(t ...interface{}) (ts []Tuple, e error)
- func (s *Space) QueryP(t ...interface{}) (tp Tuple, e error)
- func (s *Space) RawGet(t ...interface{}) (tp interface{}, e interface{})
- func (s *Space) RawGetAll(t ...interface{}) (ts interface{}, e interface{})
- func (s *Space) RawGetP(t ...interface{}) (tp interface{}, e interface{})
- func (s *Space) RawPut(t ...interface{}) (tp interface{}, e interface{})
- func (s *Space) RawPutP(t ...interface{}) (tp interface{}, e interface{})
- func (s *Space) RawQuery(t ...interface{}) (tp interface{}, e interface{})
- func (s *Space) RawQueryAll(t ...interface{}) (ts interface{}, e interface{})
- func (s *Space) RawQueryP(t ...interface{}) (tp interface{}, e interface{})
- func (s *Space) Size() (sz int)
- type SpaceError
- type TupleSpace
Constants ¶
const ( SpaceInvalid = iota SpaceNoErrorMethod SpaceOperationFailed )
Variables ¶
This section is empty.
Functions ¶
func Get ¶
func Get(ptp PointToPoint, tempFields ...interface{}) 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 GetAll ¶
func GetAll(ptp PointToPoint, tempFields ...interface{}) ([]Tuple, 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. NOTE: tuples is allowed to be an empty list, implying the tuple space was empty.
func GetP ¶
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 NewRemoteSpaceAlt ¶
func NewRemoteSpaceAlt(url string) (ptp *PointToPoint, ts *TupleSpace)
NewRemoteSpaceAlt creates a representaiton of a remote tuple space.
func NewSpaceAlt ¶
func NewSpaceAlt(url string) (ptp *PointToPoint, ts *TupleSpace)
NewSpaceAlt creates a representation of a new tuple space.
func NewSpaceError ¶
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 PointToPoint, tupleFields ...interface{}) 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 PutP ¶
func PutP(ptp PointToPoint, tupleFields ...interface{}) 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 PointToPoint, tempFields ...interface{}) 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 QueryAll ¶
func QueryAll(ptp PointToPoint, tempFields ...interface{}) ([]Tuple, 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. NOTE: tuples is allowed to be an empty list, implying the tuple space was empty.
Types ¶
type Interspace ¶
type Interspace interface { Put(tuple ...interface{}) (Tuple, error) Get(template ...interface{}) (Tuple, error) Query(template ...interface{}) (Tuple, error) PutP(tuple ...interface{}) (Tuple, error) GetP(template ...interface{}) (Tuple, error) QueryP(template ...interface{}) (Tuple, error) GetAll(template ...interface{}) ([]Tuple, error) QueryAll(template ...interface{}) ([]Tuple, error) }
Interspace defines the internal space interface. Interspace 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 ¶
NewRemoteSpace connects to a remote space rs with the specified URL.
func (*Space) Get ¶
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) GetAll ¶
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 ¶
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) InterpretError ¶
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 ¶
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 ¶
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 ¶
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) PutP ¶
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 ¶
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) QueryAll ¶
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 ¶
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) 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) RawPutP ¶
func (s *Space) RawPutP(t ...interface{}) (tp interface{}, e interface{})
RawPut performs a non-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) 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) 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.
type SpaceError ¶
type SpaceError struct {
// contains filtered or unexported fields
}
SpaceError represents an internal error type used when printing error messages.
func (SpaceError) Error ¶
func (e SpaceError) Error() string
Error prints the error message represented by SpaceError.
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)
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.