ifc

package
v0.0.0-...-6e47de9 Latest Latest
Warning

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

Go to latest
Published: Apr 16, 2019 License: BSD-3-Clause Imports: 5 Imported by: 0

README

Generate the go file with:

VDLPATH=$HOME/src vdl generate github.com/jeffallen/mqtt/vbridge/ifc

Documentation

Index

Constants

This section is empty.

Variables

View Source
var BridgeDesc rpc.InterfaceDesc = descBridge

BridgeDesc describes the Bridge interface.

Functions

This section is empty.

Types

type BridgeClientMethods

type BridgeClientMethods interface {
	// Links a pair of MQTT brokers for a given set of topics. All messages on
	// those topics received at the caller are sent on the input stream to the
	// callee, and all messages on those topics received at the callee are
	// sent on the output stream.
	Link(_ *context.T, topics []Topic, _ ...rpc.CallOpt) (BridgeLinkClientCall, error)
}

BridgeClientMethods is the client interface containing Bridge methods.

type BridgeClientStub

type BridgeClientStub interface {
	BridgeClientMethods
	rpc.UniversalServiceMethods
}

BridgeClientStub adds universal methods to BridgeClientMethods.

func BridgeClient

func BridgeClient(name string) BridgeClientStub

BridgeClient returns a client stub for Bridge.

type BridgeLinkClientCall

type BridgeLinkClientCall interface {
	BridgeLinkClientStream
	// Finish performs the equivalent of SendStream().Close, then blocks until
	// the server is done, and returns the positional return values for the call.
	//
	// Finish returns immediately if the call has been canceled; depending on the
	// timing the output could either be an error signaling cancelation, or the
	// valid positional return values from the server.
	//
	// Calling Finish is mandatory for releasing stream resources, unless the call
	// has been canceled or any of the other methods return an error.  Finish should
	// be called at most once.
	Finish() error
}

BridgeLinkClientCall represents the call returned from Bridge.Link.

type BridgeLinkClientStream

type BridgeLinkClientStream interface {
	// RecvStream returns the receiver side of the Bridge.Link client stream.
	RecvStream() interface {
		// Advance stages an item so that it may be retrieved via Value.  Returns
		// true iff there is an item to retrieve.  Advance must be called before
		// Value is called.  May block if an item is not available.
		Advance() bool
		// Value returns the item that was staged by Advance.  May panic if Advance
		// returned false or was not called.  Never blocks.
		Value() Message
		// Err returns any error encountered by Advance.  Never blocks.
		Err() error
	}
	// SendStream returns the send side of the Bridge.Link client stream.
	SendStream() interface {
		// Send places the item onto the output stream.  Returns errors
		// encountered while sending, or if Send is called after Close or
		// the stream has been canceled.  Blocks if there is no buffer
		// space; will unblock when buffer space is available or after
		// the stream has been canceled.
		Send(item Message) error
		// Close indicates to the server that no more items will be sent;
		// server Recv calls will receive io.EOF after all sent items.
		// This is an optional call - e.g. a client might call Close if it
		// needs to continue receiving items from the server after it's
		// done sending.  Returns errors encountered while closing, or if
		// Close is called after the stream has been canceled.  Like Send,
		// blocks if there is no buffer space available.
		Close() error
	}
}

BridgeLinkClientStream is the client stream for Bridge.Link.

type BridgeLinkServerCall

type BridgeLinkServerCall interface {
	rpc.ServerCall
	BridgeLinkServerStream
}

BridgeLinkServerCall represents the context passed to Bridge.Link.

type BridgeLinkServerCallStub

type BridgeLinkServerCallStub struct {
	rpc.StreamServerCall
	// contains filtered or unexported fields
}

BridgeLinkServerCallStub is a wrapper that converts rpc.StreamServerCall into a typesafe stub that implements BridgeLinkServerCall.

func (*BridgeLinkServerCallStub) Init

Init initializes BridgeLinkServerCallStub from rpc.StreamServerCall.

func (*BridgeLinkServerCallStub) RecvStream

func (s *BridgeLinkServerCallStub) RecvStream() interface {
	Advance() bool
	Value() Message
	Err() error
}

RecvStream returns the receiver side of the Bridge.Link server stream.

func (*BridgeLinkServerCallStub) SendStream

func (s *BridgeLinkServerCallStub) SendStream() interface {
	Send(item Message) error
}

SendStream returns the send side of the Bridge.Link server stream.

type BridgeLinkServerStream

type BridgeLinkServerStream interface {
	// RecvStream returns the receiver side of the Bridge.Link server stream.
	RecvStream() interface {
		// Advance stages an item so that it may be retrieved via Value.  Returns
		// true iff there is an item to retrieve.  Advance must be called before
		// Value is called.  May block if an item is not available.
		Advance() bool
		// Value returns the item that was staged by Advance.  May panic if Advance
		// returned false or was not called.  Never blocks.
		Value() Message
		// Err returns any error encountered by Advance.  Never blocks.
		Err() error
	}
	// SendStream returns the send side of the Bridge.Link server stream.
	SendStream() interface {
		// Send places the item onto the output stream.  Returns errors encountered
		// while sending.  Blocks if there is no buffer space; will unblock when
		// buffer space is available.
		Send(item Message) error
	}
}

BridgeLinkServerStream is the server stream for Bridge.Link.

type BridgeServerMethods

type BridgeServerMethods interface {
	// Links a pair of MQTT brokers for a given set of topics. All messages on
	// those topics received at the caller are sent on the input stream to the
	// callee, and all messages on those topics received at the callee are
	// sent on the output stream.
	Link(_ *context.T, _ BridgeLinkServerCall, topics []Topic) error
}

BridgeServerMethods is the interface a server writer implements for Bridge.

type BridgeServerStub

type BridgeServerStub interface {
	BridgeServerStubMethods
	// Describe the Bridge interfaces.
	Describe__() []rpc.InterfaceDesc
}

BridgeServerStub adds universal methods to BridgeServerStubMethods.

func BridgeServer

func BridgeServer(impl BridgeServerMethods) BridgeServerStub

BridgeServer returns a server stub for Bridge. It converts an implementation of BridgeServerMethods into an object that may be used by rpc.Server.

type BridgeServerStubMethods

type BridgeServerStubMethods interface {
	// Links a pair of MQTT brokers for a given set of topics. All messages on
	// those topics received at the caller are sent on the input stream to the
	// callee, and all messages on those topics received at the callee are
	// sent on the output stream.
	Link(_ *context.T, _ *BridgeLinkServerCallStub, topics []Topic) error
}

BridgeServerStubMethods is the server interface containing Bridge methods, as expected by rpc.Server. The only difference between this interface and BridgeServerMethods is the streaming methods.

type Message

type Message struct {
	Topic     string
	MessageId uint16
	Payload   []byte
}

type Topic

type Topic string

Jump to

Keyboard shortcuts

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