Documentation ¶
Overview ¶
package core allows communciation over the fabric.
See the official WAMP documentation at exis.io for more details on the protocol.
Index ¶
- Constants
- Variables
- func Application(format string, a ...interface{})
- func Cumin(fn interface{}, args []interface{}) ([]interface{}, error)
- func Debug(format string, a ...interface{})
- func DecodePrivateKey(data []byte) (*rsa.PrivateKey, error)
- func Error(format string, a ...interface{})
- func GetValueOf(x interface{}) reflect.Value
- func Info(format string, a ...interface{})
- func MantleCall(d Domain, endpoint string, cb uint64, eb uint64, args []interface{})
- func MantleMarshall(d Callback) string
- func MantleModel(d Domain, target func(string, map[string]interface{}) ([]interface{}, error), ...)
- func MantlePublish(d Domain, endpoint string, cb uint64, eb uint64, args []interface{})
- func MantleRegister(d Domain, endpoint string, cb uint64, eb uint64, handler uint64, ...)
- func MantleSubscribe(d Domain, endpoint string, cb uint64, eb uint64, handler uint64, ...)
- func MantleUnmarshal(a string) []interface{}
- func MantleUnmarshalMap(a string) map[string]interface{}
- func MantleUnregister(d Domain, endpoint string, cb uint64, eb uint64)
- func MantleUnsubscribe(d Domain, endpoint string, cb uint64, eb uint64)
- func NewApp() *app
- func NewID() uint64
- func SignString(msg string, key *rsa.PrivateKey) (string, error)
- func SoftCumin(types []interface{}, args []interface{}) error
- func Warn(format string, a ...interface{})
- type App
- type Callback
- type Connection
- type Domain
- type IdGenerator
- type InvalidURIError
- type Model
- type NoDestinationError
- type Serialization
Constants ¶
const ( Disconnected = iota Connected Ready Leaving )
const ( // A call could not be performed because there is no registered handler // for the endpoint. ErrNoSuchRegistration = "wamp.error.no_such_registration" // A call failed because the given argument types or values differ from // what the callee expects. ErrInvalidArgument = "wamp.error.invalid_argument" // The peer wants to close the session, sent as a GOODBYE reason. ErrCloseSession = "wamp.error.close_session" )
const ( LogLevelOff int = 0 LogLevelApp int = 1 LogLevelErr int = 2 LogLevelWarn int = 3 LogLevelInfo int = 4 LogLevelDebug int = 5 )
const ( MessageTimeout time.Duration = 3 * time.Hour FabricLocal = "ws://localhost:8000/ws" FabricDev = "ws://ec2-52-26-83-61.us-west-2.compute.amazonaws.com:8000/ws" FabricSandbox = "ws://sandbox.exis.io:8000/ws" FabricProduction = "wss://node.exis.io:8000/wss" RegistrarLocal = "http://localhost:8880" RegistrarDev = "http://ec2-52-26-83-61.us-west-2.compute.amazonaws.com:8880" RegistrarProduction = "https://node.exis.io:8880" CuminStrict = 2 CuminLoose = 1 CuminOff = 0 )
Variables ¶
var ( LogLevel int = 1 Fabric string = FabricProduction Registrar string = RegistrarProduction CuminLevel int = CuminLoose UseUnsafeCert bool = false )
var (
ShouldLogLineNumber = true // Print the line that emitted the log
)
Functions ¶
func Application ¶
func Application(format string, a ...interface{})
func Cumin ¶
func Cumin(fn interface{}, args []interface{}) ([]interface{}, error)
Convert and apply args to arbitrary function fn
func DecodePrivateKey ¶
func DecodePrivateKey(data []byte) (*rsa.PrivateKey, error)
func GetValueOf ¶
Wraps reflect.ValueOf to handle the case where an integer value is stored as a float64, as JSON unmarshal does.
func MantleCall ¶
func MantleMarshall ¶
Marshall data into json as it moves from the core to the crust
func MantleModel ¶
func MantleModel(d Domain, target func(string, map[string]interface{}) ([]interface{}, error), collection string, query map[string]interface{}, cb uint64, eb uint64)
Access the model object functions. Note these methods have identical interfaces to allow this one method to do all the heavy lifting TODO: implement cuminication of these results
func MantlePublish ¶
func MantleRegister ¶
func MantleSubscribe ¶
func MantleUnmarshal ¶
func MantleUnmarshal(a string) []interface{}
Unmarshal json data in the mantle as it arrives from the crust
func MantleUnmarshalMap ¶
Sloppy deserialization, please merge
func SignString ¶
func SignString(msg string, key *rsa.PrivateKey) (string, error)
Types ¶
type App ¶
type App interface { ReceiveBytes([]byte) ReceiveMessage(message) Yield(uint64, []interface{}) YieldError(uint64, string, []interface{}) YieldOptions(request uint64, args []interface{}, options map[string]interface{}) Close(string) ConnectionClosed(string) CallbackListen() Callback CallbackSend(uint64, ...interface{}) SendHello() error // Temporary location, will move to security SetToken(string) GetToken() string LoadKey(string) error Login(Domain, ...string) (Domain, error) RegisterAccount(Domain, string, string, string, string) (bool, error) SetState(int) ShouldReconnect() bool NextRetryDelay() time.Duration }
type Callback ¶
type Callback struct { Id uint64 Args []interface{} }
Sent up to the mantle and then the crust as callbacks are triggered
type Domain ¶
type Domain interface { Subdomain(string) Domain LinkDomain(string) Domain Subscribe(string, uint64, []interface{}, map[string]interface{}) error Register(string, uint64, []interface{}, map[string]interface{}) error Publish(string, []interface{}, map[string]interface{}) error Call(string, []interface{}, map[string]interface{}) ([]interface{}, error) Unsubscribe(string) error Unregister(string) error CallExpects(uint64, []interface{}) GetCallExpect(uint64) ([]interface{}, bool) RemoveCallExpect(uint64) Join(Connection) error Leave() error GetApp() App GetName() string }
type IdGenerator ¶
type IdGenerator interface {
NewID() uint64
}
An external generator of ids based on platform differences
var ExternalGenerator IdGenerator = nil
If this is set, core relies on this to generate IDs instead of its own logic
type InvalidURIError ¶
type InvalidURIError string
func (InvalidURIError) Error ¶
func (e InvalidURIError) Error() string
type Model ¶
type Model interface { All(string, map[string]interface{}) ([]interface{}, error) Find(string, map[string]interface{}) ([]interface{}, error) Create(string, map[string]interface{}) ([]interface{}, error) Save(string, map[string]interface{}) ([]interface{}, error) Count(string, map[string]interface{}) ([]interface{}, error) }
func SetSession ¶
Set a session and return a new model interface. The session must already be joined
type NoDestinationError ¶
type NoDestinationError string
func (NoDestinationError) Error ¶
func (e NoDestinationError) Error() string
type Serialization ¶
type Serialization int