client

package
v0.0.0-...-5e74752 Latest Latest
Warning

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

Go to latest
Published: Sep 12, 2016 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrHandleNameTooLong = errors.New("Handle name too long")
	ErrHandleNotFound    = errors.New("Handle not found")
	ErrHandleExists      = errors.New("Handle exists")
)

Functions

func MakeCourceByData

func MakeCourceByData(c Client, data icarus.CourseData) (icarus.Course, error)

func MakeUserByData

func MakeUserByData(c Client, data icarus.UserData) (icarus.User, error)

func RegisterHandle

func RegisterHandle(handle string, cli Client) error

func RegisterWorker

func RegisterWorker(handle string, w Worker) error

func RegisteredHandle

func RegisteredHandle() map[string]Client

func RegisteredList

func RegisteredList() []string

func RegisteredWorker

func RegisteredWorker() map[string]Worker

func RegisteredWorkerList

func RegisteredWorkerList() []string

Types

type Client

type Client interface {
	// Factory functions of actual (not abstract) users and courses.
	MakeUser(userID string, password string) (icarus.User, error)
	MakeCourse(name string, desc string, token string) (icarus.Course, error)
}

Client is in icarus (server part).

Server part invokes dispatcher to send task,

(most times the only needed work is
 to use standard dispatcher functions)

and the satellite part do the actual work.

func GetHandle

func GetHandle(handle string) (Client, error)

type Worker

type Worker interface {
	Login(data []string) []string
	ListCourse(data []string) []string
	Elect(data []string) []string
}

Worker is in icarus-satellite.

What worker needs to do is to handle server's subtask and do actual response. All datum are transfered in []string so the worker need to understand server's

request correctly and generate suitable response. Errors should be coded in
response so worker cannot generate any Go-style errors.

func GetWorker

func GetWorker(handle string) (Worker, error)

Directories

Path Synopsis
pku

Jump to

Keyboard shortcuts

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