service

package
v0.0.0-...-8666326 Latest Latest
Warning

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

Go to latest
Published: Jul 30, 2014 License: BSD-2-Clause Imports: 4 Imported by: 0

Documentation

Overview

Package service implements server and client for the elvishd service.

Index

Constants

View Source
const (
	Version = "0"
)

Variables

View Source
var (
	VersionMismatch = errors.New("version mismatch")
	UniVarNotFound  = errors.New("universal variable not found")
)

Functions

func Serve

func Serve(listener net.Listener, dbmap *gorp.DbMap) error

Serve starts the RPC server on listener. Serve blocks.

Types

type Client

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

Client wraps rpc.Client with type-safe wrappers.

func Dial

func Dial(network, address string) (Client, error)

Dial establishes RPC connection and check for version mismatch.

func (Client) Echo

func (c Client) Echo(arg string, reply *string) error

func (Client) GetUniVar

func (c Client) GetUniVar(arg string, reply *string) error

func (Client) SetUniVar

func (c Client) SetUniVar(arg *UniVar, reply *struct{}) error

func (Client) Version

func (c Client) Version(arg struct{}, reply *string) error

type Elvishd

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

func (*Elvishd) Echo

func (e *Elvishd) Echo(arg string, reply *string) error

Echo replies with an exact duplicate of the argument string. Could be useful for testing.

func (*Elvishd) GetUniVar

func (e *Elvishd) GetUniVar(arg string, reply *string) error

GetUniVar replies with the value of the universal variable with the name arg. If the named variable does not exist or there is a database error, an error is returned instead.

func (*Elvishd) SetUniVar

func (e *Elvishd) SetUniVar(arg *UniVar, reply *struct{}) error

SetUniVar sets the universal variable to the given value. It is created if nonexistent. If there is a database error, an error is returned.

func (*Elvishd) Version

func (e *Elvishd) Version(arg struct{}, reply *string) error

Version replies with a string that identify the RPC version.

type UniVar

type UniVar struct {
	Name  string
	Value string // TODO(xiaq): support arbitrary elvish value
}

Jump to

Keyboard shortcuts

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