smc

package
v0.0.0-...-496ee5d Latest Latest
Warning

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

Go to latest
Published: Sep 6, 2017 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const ParallelSessions int = 2

Variables

View Source
var DefaultSMCConnector = newFrescoConnector

DefaultSMCConnector set to Fresco connector. Requires flexsmc-fresco to be up.

View Source
var (
	ErrInvTransition = errors.New("invalid transition")
)
View Source
var (
	ErrSessionID = errors.New("altering session not allowed here")
)

Functions

func DialSocket

func DialSocket(bindAddr string) (*grpc.ClientConn, error)

DialSocket connects to a gRPC server via localhost.

Types

type Connector

type Connector interface {
	// RequestSession blocks until resources allow for a new Session.
	// The context can abort an ongoing request. This will cause an error.
	RequestSession(ctx context.Context) (Session, error)
	// ResetAll tears down any active sessions and cleans up.
	// Call it before requesting the first session if there are possibly any open
	// sessions due to a previous connection abort, for instance.
	ResetAll(ctx context.Context) error
}

Connector opens a Session with a SMC backend to control and track its computation.

type FrescoConnect

type FrescoConnect struct {
	// contains filtered or unexported fields
}

func (*FrescoConnect) RequestSession

func (con *FrescoConnect) RequestSession(ctx context.Context) (Session, error)

func (*FrescoConnect) ResetAll

func (con *FrescoConnect) ResetAll(ctx context.Context) error

type Session

type Session interface {
	Init(ctx context.Context, id string) error
	// ID of the current session.
	ID() string
	// NextCmd evaluates the input command, forwards it to the SMC backend and sends back
	// the result of the command evaluation.
	// It blocks until the request is processed or the context is done.
	NextCmd(in *pbJob.SMCCmd) (out *pbJob.CmdResult, more bool)
	// TearDown finishes a session and frees occupied resources. This should be called
	// if the originator is not interested anymore to keep the SMC reservation alive.
	TearDown()
	// Err returns a non-nil if an error occurred during any phase.
	Err() error
}

Jump to

Keyboard shortcuts

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