skynet: Index | Files | Directories

package skynet

import ""


Package Files

criteria.go handshake.go logmessages.go messages.go requestinfo.go serviceinfo.go servicemanager.go


const (

func SetServiceManager Uses

func SetServiceManager(sm ServiceManager)

type BindAddr Uses

type BindAddr struct {
    IPAddress string
    Port      int
    MaxPort   int

func BindAddrFromString Uses

func BindAddrFromString(host string) (ba BindAddr, err error)

func (*BindAddr) Listen Uses

func (ba *BindAddr) Listen() (listener *net.TCPListener, err error)

func (*BindAddr) String Uses

func (ba *BindAddr) String() string

type ClientHandshake Uses

type ClientHandshake struct {
    ClientID string

ClientHandshake is sent by the client to the service after receipt of the ServiceHandshake.

type Criteria Uses

type Criteria struct {
    Hosts      []string
    Regions    []string
    Instances  []string
    Services   []ServiceCriteria
    Registered *bool

func (*Criteria) AddHost Uses

func (c *Criteria) AddHost(host string)

func (*Criteria) AddInstance Uses

func (c *Criteria) AddInstance(uuid string)

func (*Criteria) AddRegion Uses

func (c *Criteria) AddRegion(region string)

func (*Criteria) AddService Uses

func (c *Criteria) AddService(service ServiceCriteria)

func (*Criteria) Clone Uses

func (c *Criteria) Clone() *Criteria

Returns a copy of this criteria

func (*Criteria) Matches Uses

func (c *Criteria) Matches(s ServiceInfo) bool

type CriteriaMatcher Uses

type CriteriaMatcher interface {
    Matches(s ServiceInfo) bool

type InstanceNotification Uses

type InstanceNotification struct {
    Type    int
    Service ServiceInfo

type RegisterRequest Uses

type RegisterRequest struct {

type RegisterResponse Uses

type RegisterResponse struct {

type RequestInfo Uses

type RequestInfo struct {
    // OriginAddress is the reported address of the originating client, typically from outside the service cluster.
    OriginAddress string
    // ConnectionAddress is the address of the TCP connection making the current RPC request.
    ConnectionAddress string
    // RequestID is a unique ID for the current RPC request.
    RequestID string
    // RetryCount indicates how many times this request has been tried before.
    RetryCount int

RequestInfo is information about a request, and is provided to every skynet RPC call.

type ServiceCreated Uses

type ServiceCreated struct {
    ServiceInfo *ServiceInfo

func (ServiceCreated) String Uses

func (sc ServiceCreated) String() string

type ServiceCriteria Uses

type ServiceCriteria struct {
    Name    string
    Version string

func (*ServiceCriteria) Matches Uses

func (sc *ServiceCriteria) Matches(name, version string) bool

func (*ServiceCriteria) String Uses

func (sc *ServiceCriteria) String() string

type ServiceDiscovered Uses

type ServiceDiscovered struct {
    Service *ServiceInfo

func (ServiceDiscovered) String Uses

func (sd ServiceDiscovered) String() string

type ServiceHandshake Uses

type ServiceHandshake struct {
    // Name indicates the service name, for validation on the client side
    Name string

    // Registered indicates the state of this service. If it is false, the connection will
    // close immediately and the client should look elsewhere for this service.
    Registered bool

    // ClientID is a UUID that is used by the client to identify itself in RPC requests.
    ClientID string

ServiceHandshake is data sent by the service to the client immediately once the connection is opened.

type ServiceInfo Uses

type ServiceInfo struct {
    UUID    string
    Name    string
    Version string
    Region  string

    ServiceAddr BindAddr

    // Registered indicates if the instance is currently accepting requests.
    Registered bool

ServiceInfo is the publicly reported information about a particular service instance.

func NewServiceInfo Uses

func NewServiceInfo(name, version string) (si *ServiceInfo)

func (ServiceInfo) AddrString Uses

func (si ServiceInfo) AddrString() string

type ServiceManager Uses

type ServiceManager interface {
    Add(s ServiceInfo) error
    Update(s ServiceInfo) error
    Remove(s ServiceInfo) error
    Register(uuid string) error
    Unregister(uuid string) error

    Shutdown() error

    // Discovery
    ListHosts(c CriteriaMatcher) ([]string, error)
    ListRegions(c CriteriaMatcher) ([]string, error)
    ListServices(c CriteriaMatcher) ([]string, error)
    ListVersions(c CriteriaMatcher) ([]string, error)
    ListInstances(c CriteriaMatcher) ([]ServiceInfo, error)
    Watch(criteria CriteriaMatcher, c chan<- InstanceNotification) []ServiceInfo

func GetServiceManager Uses

func GetServiceManager() ServiceManager

type ServiceRPCInRead Uses

type ServiceRPCInRead struct {
    ClientID    string
    Method      string
    RequestInfo *RequestInfo
    In          []byte

type ServiceRPCInWrite Uses

type ServiceRPCInWrite struct {
    ClientID    string
    Method      string
    RequestInfo *RequestInfo
    In          bson.Binary

type ServiceRPCOutRead Uses

type ServiceRPCOutRead struct {
    Out       []byte
    ErrString string

type ServiceRPCOutWrite Uses

type ServiceRPCOutWrite struct {
    Out       bson.Binary
    ErrString string

type ServiceRemoved Uses

type ServiceRemoved struct {
    Service *ServiceInfo

func (ServiceRemoved) String Uses

func (sr ServiceRemoved) String() string

type ServiceStatistics Uses

type ServiceStatistics struct {
    // Clients is the number of clients currently connected to this service.
    Clients int32
    // StartTime is the time when the service began running.
    StartTime string
    // LastRequest is the time when the last request was made.
    LastRequest string

ServiceStatistics contains information about its service that can be used to estimate load.

type StopRequest Uses

type StopRequest struct {
    WaitForClients bool

type StopResponse Uses

type StopResponse struct {

type UnregisterRequest Uses

type UnregisterRequest struct {

type UnregisterResponse Uses

type UnregisterResponse struct {


logPackage log provides syslog logging to a local or remote Syslog logger.

Package skynet imports 8 packages (graph) and is imported by 129 packages. Updated 2016-11-06. Refresh now. Tools for package owners.