spec

package
v0.0.0-...-505f793 Latest Latest
Warning

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

Go to latest
Published: Aug 21, 2016 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Overview

Package spec defines the interfaces between networked participants of the triagles display.

go get v.io/x/ref/cmd/vdl
VDLPATH=$GOPATH/src $GOPATH/bin/vdl --builtin_vdlroot generate github.com/asimshankar/triangles/spec

Index

Constants

This section is empty.

Variables

View Source
var ScreenDesc rpc.InterfaceDesc = descScreen

ScreenDesc describes the Screen interface.

Functions

This section is empty.

Types

type ScreenClientMethods

type ScreenClientMethods interface {
	// Invite is a request to the receiver to join the set of screens that
	// the caller is participating in, by standing to the right of the
	// caller.
	//
	// A Screen can be active on at most one invitation at a time and
	// should return an error if it is engaged in a previous invitation.
	Invite(*context.T, ...rpc.CallOpt) error
	// Give is a request by the caller for the receiver to take ownership
	// of the provided triangle.
	//
	// Give is typically invoked on the receiver by the adjacent screen
	// when a triangle falls off that adjacent screen. However, this is not
	// a requirement and Give can be invoked by an arbitrary client to
	// manufacture a new triangle.
	Give(_ *context.T, t Triangle, _ ...rpc.CallOpt) error
}

ScreenClientMethods is the client interface containing Screen methods.

Screen represents a remote screen that can be invited to grab triangles.

type ScreenClientStub

type ScreenClientStub interface {
	ScreenClientMethods
	rpc.UniversalServiceMethods
}

ScreenClientStub adds universal methods to ScreenClientMethods.

func ScreenClient

func ScreenClient(name string) ScreenClientStub

ScreenClient returns a client stub for Screen.

type ScreenServerMethods

type ScreenServerMethods interface {
	// Invite is a request to the receiver to join the set of screens that
	// the caller is participating in, by standing to the right of the
	// caller.
	//
	// A Screen can be active on at most one invitation at a time and
	// should return an error if it is engaged in a previous invitation.
	Invite(*context.T, rpc.ServerCall) error
	// Give is a request by the caller for the receiver to take ownership
	// of the provided triangle.
	//
	// Give is typically invoked on the receiver by the adjacent screen
	// when a triangle falls off that adjacent screen. However, this is not
	// a requirement and Give can be invoked by an arbitrary client to
	// manufacture a new triangle.
	Give(_ *context.T, _ rpc.ServerCall, t Triangle) error
}

ScreenServerMethods is the interface a server writer implements for Screen.

Screen represents a remote screen that can be invited to grab triangles.

type ScreenServerStub

type ScreenServerStub interface {
	ScreenServerStubMethods
	// Describe the Screen interfaces.
	Describe__() []rpc.InterfaceDesc
}

ScreenServerStub adds universal methods to ScreenServerStubMethods.

func ScreenServer

func ScreenServer(impl ScreenServerMethods) ScreenServerStub

ScreenServer returns a server stub for Screen. It converts an implementation of ScreenServerMethods into an object that may be used by rpc.Server.

type ScreenServerStubMethods

type ScreenServerStubMethods ScreenServerMethods

ScreenServerStubMethods is the server interface containing Screen methods, as expected by rpc.Server. There is no difference between this interface and ScreenServerMethods since there are no streaming methods.

type Triangle

type Triangle struct {
	X  float32
	Y  float32
	Dx float32
	Dy float32
	R  float32
	G  float32
	B  float32
}

Triangle represents a triangle that will be displayed on the screen.

The coordinates (X, Y) and velocity (Dx, Dy) are in a world where (0, 0) is the center, (1, 1) is the bottom right and (-1, -1) is the top left.

R, G, B denote the color of the triangle.

Jump to

Keyboard shortcuts

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