rpc

package
v0.5.2 Latest Latest
Warning

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

Go to latest
Published: Feb 22, 2014 License: MPL-2.0 Imports: 11 Imported by: 0

Documentation ¶

Index ¶

Constants ¶

View Source
const (
	DefaultArtifactEndpoint      string = "Artifact"
	DefaultBuildEndpoint                = "Build"
	DefaultBuilderEndpoint              = "Builder"
	DefaultCacheEndpoint                = "Cache"
	DefaultCommandEndpoint              = "Command"
	DefaultCommunicatorEndpoint         = "Communicator"
	DefaultEnvironmentEndpoint          = "Environment"
	DefaultHookEndpoint                 = "Hook"
	DefaultPostProcessorEndpoint        = "PostProcessor"
	DefaultProvisionerEndpoint          = "Provisioner"
	DefaultUiEndpoint                   = "Ui"
)

Variables ¶

This section is empty.

Functions ¶

func Communicator ¶

func Communicator(client *rpc.Client) *communicator

Types ¶

type ArtifactServer ¶

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

ArtifactServer wraps a packer.Artifact implementation and makes it exportable as part of a Golang RPC server.

func (*ArtifactServer) BuilderId ¶

func (s *ArtifactServer) BuilderId(args *interface{}, reply *string) error

func (*ArtifactServer) Destroy ¶

func (s *ArtifactServer) Destroy(args *interface{}, reply *error) error

func (*ArtifactServer) Files ¶

func (s *ArtifactServer) Files(args *interface{}, reply *[]string) error

func (*ArtifactServer) Id ¶

func (s *ArtifactServer) Id(args *interface{}, reply *string) error

func (*ArtifactServer) String ¶

func (s *ArtifactServer) String(args *interface{}, reply *string) error

type BasicError ¶

type BasicError struct {
	Message string
}

This is a type that wraps error types so that they can be messaged across RPC channels. Since "error" is an interface, we can't always gob-encode the underlying structure. This is a valid error interface implementer that we will push across.

func NewBasicError ¶

func NewBasicError(err error) *BasicError

func (*BasicError) Error ¶

func (e *BasicError) Error() string

type BuildPrepareResponse ¶ added in v0.3.11

type BuildPrepareResponse struct {
	Warnings []string
	Error    error
}

type BuildServer ¶

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

BuildServer wraps a packer.Build implementation and makes it exportable as part of a Golang RPC server.

func (*BuildServer) Cancel ¶

func (b *BuildServer) Cancel(args *interface{}, reply *interface{}) error

func (*BuildServer) Name ¶

func (b *BuildServer) Name(args *interface{}, reply *string) error

func (*BuildServer) Prepare ¶

func (b *BuildServer) Prepare(args *interface{}, resp *BuildPrepareResponse) error

func (*BuildServer) Run ¶

func (b *BuildServer) Run(streamId uint32, reply *[]uint32) error

func (*BuildServer) SetDebug ¶

func (b *BuildServer) SetDebug(val *bool, reply *interface{}) error

func (*BuildServer) SetForce ¶ added in v0.2.0

func (b *BuildServer) SetForce(val *bool, reply *interface{}) error

type BuilderPrepareArgs ¶

type BuilderPrepareArgs struct {
	Configs []interface{}
}

type BuilderPrepareResponse ¶ added in v0.3.11

type BuilderPrepareResponse struct {
	Warnings []string
	Error    error
}

type BuilderServer ¶

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

BuilderServer wraps a packer.Builder implementation and makes it exportable as part of a Golang RPC server.

func (*BuilderServer) Cancel ¶

func (b *BuilderServer) Cancel(args *interface{}, reply *interface{}) error

func (*BuilderServer) Prepare ¶

func (*BuilderServer) Run ¶

func (b *BuilderServer) Run(streamId uint32, reply *uint32) error

type CacheRLockResponse ¶

type CacheRLockResponse struct {
	Path   string
	Exists bool
}

type CacheServer ¶

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

CacheServer wraps a packer.Cache implementation and makes it exportable as part of a Golang RPC server.

func (*CacheServer) Lock ¶

func (c *CacheServer) Lock(key string, result *string) error

func (*CacheServer) RLock ¶

func (c *CacheServer) RLock(key string, result *CacheRLockResponse) error

func (*CacheServer) RUnlock ¶

func (c *CacheServer) RUnlock(key string, result *interface{}) error

func (*CacheServer) Unlock ¶

func (c *CacheServer) Unlock(key string, result *interface{}) error

type Client ¶ added in v0.5.0

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

Client is the client end that communicates with a Packer RPC server. Establishing a connection is up to the user, the Client can just communicate over any ReadWriteCloser.

func NewClient ¶ added in v0.5.0

func NewClient(rwc io.ReadWriteCloser) (*Client, error)

func (*Client) Artifact ¶ added in v0.5.0

func (c *Client) Artifact() packer.Artifact

func (*Client) Build ¶ added in v0.5.0

func (c *Client) Build() packer.Build

func (*Client) Builder ¶ added in v0.5.0

func (c *Client) Builder() packer.Builder

func (*Client) Cache ¶ added in v0.5.0

func (c *Client) Cache() packer.Cache

func (*Client) Close ¶ added in v0.5.0

func (c *Client) Close() error

func (*Client) Command ¶ added in v0.5.0

func (c *Client) Command() packer.Command

func (*Client) Communicator ¶ added in v0.5.0

func (c *Client) Communicator() packer.Communicator

func (*Client) Environment ¶ added in v0.5.0

func (c *Client) Environment() packer.Environment

func (*Client) Hook ¶ added in v0.5.0

func (c *Client) Hook() packer.Hook

func (*Client) PostProcessor ¶ added in v0.5.0

func (c *Client) PostProcessor() packer.PostProcessor

func (*Client) Provisioner ¶ added in v0.5.0

func (c *Client) Provisioner() packer.Provisioner

func (*Client) Ui ¶ added in v0.5.0

func (c *Client) Ui() packer.Ui

type CommandFinished ¶

type CommandFinished struct {
	ExitStatus int
}

type CommandRunArgs ¶

type CommandRunArgs struct {
	Args     []string
	StreamId uint32
}

type CommandServer ¶

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

A CommandServer wraps a packer.Command and makes it exportable as part of a Golang RPC server.

func (*CommandServer) Help ¶

func (c *CommandServer) Help(args *interface{}, reply *string) error

func (*CommandServer) Run ¶

func (c *CommandServer) Run(args *CommandRunArgs, reply *int) error

func (*CommandServer) Synopsis ¶

func (c *CommandServer) Synopsis(args *CommandSynopsisArgs, reply *string) error

type CommandSynopsisArgs ¶

type CommandSynopsisArgs byte

type CommunicatorDownloadArgs ¶

type CommunicatorDownloadArgs struct {
	Path           string
	WriterStreamId uint32
}

type CommunicatorServer ¶

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

CommunicatorServer wraps a packer.Communicator implementation and makes it exportable as part of a Golang RPC server.

func (*CommunicatorServer) Download ¶

func (c *CommunicatorServer) Download(args *CommunicatorDownloadArgs, reply *interface{}) (err error)

func (*CommunicatorServer) Start ¶

func (c *CommunicatorServer) Start(args *CommunicatorStartArgs, reply *interface{}) error

func (*CommunicatorServer) Upload ¶

func (c *CommunicatorServer) Upload(args *CommunicatorUploadArgs, reply *interface{}) (err error)

func (*CommunicatorServer) UploadDir ¶ added in v0.3.5

func (c *CommunicatorServer) UploadDir(args *CommunicatorUploadDirArgs, reply *error) error

type CommunicatorStartArgs ¶

type CommunicatorStartArgs struct {
	Command          string
	StdinStreamId    uint32
	StdoutStreamId   uint32
	StderrStreamId   uint32
	ResponseStreamId uint32
}

type CommunicatorUploadArgs ¶

type CommunicatorUploadArgs struct {
	Path           string
	ReaderStreamId uint32
}

type CommunicatorUploadDirArgs ¶ added in v0.3.5

type CommunicatorUploadDirArgs struct {
	Dst     string
	Src     string
	Exclude []string
}

type Environment ¶

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

A Environment is an implementation of the packer.Environment interface where the actual environment is executed over an RPC connection.

func (*Environment) Builder ¶

func (e *Environment) Builder(name string) (b packer.Builder, err error)

func (*Environment) Cache ¶

func (e *Environment) Cache() packer.Cache

func (*Environment) Cli ¶

func (e *Environment) Cli(args []string) (result int, err error)

func (*Environment) Hook ¶

func (e *Environment) Hook(name string) (h packer.Hook, err error)

func (*Environment) PostProcessor ¶

func (e *Environment) PostProcessor(name string) (p packer.PostProcessor, err error)

func (*Environment) Provisioner ¶

func (e *Environment) Provisioner(name string) (p packer.Provisioner, err error)

func (*Environment) Ui ¶

func (e *Environment) Ui() packer.Ui

type EnvironmentCliArgs ¶

type EnvironmentCliArgs struct {
	Args []string
}

type EnvironmentServer ¶

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

A EnvironmentServer wraps a packer.Environment and makes it exportable as part of a Golang RPC server.

func (*EnvironmentServer) Builder ¶

func (e *EnvironmentServer) Builder(name string, reply *uint32) error

func (*EnvironmentServer) Cache ¶

func (e *EnvironmentServer) Cache(args *interface{}, reply *uint32) error

func (*EnvironmentServer) Cli ¶

func (e *EnvironmentServer) Cli(args *EnvironmentCliArgs, reply *int) (err error)

func (*EnvironmentServer) Hook ¶

func (e *EnvironmentServer) Hook(name string, reply *uint32) error

func (*EnvironmentServer) PostProcessor ¶

func (e *EnvironmentServer) PostProcessor(name string, reply *uint32) error

func (*EnvironmentServer) Provisioner ¶

func (e *EnvironmentServer) Provisioner(name string, reply *uint32) error

func (*EnvironmentServer) Ui ¶

func (e *EnvironmentServer) Ui(args *interface{}, reply *uint32) error

type HookRunArgs ¶

type HookRunArgs struct {
	Name     string
	Data     interface{}
	StreamId uint32
}

type HookServer ¶

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

HookServer wraps a packer.Hook implementation and makes it exportable as part of a Golang RPC server.

func (*HookServer) Cancel ¶ added in v0.3.6

func (h *HookServer) Cancel(args *interface{}, reply *interface{}) error

func (*HookServer) Run ¶

func (h *HookServer) Run(args *HookRunArgs, reply *interface{}) error

type MuxConn ¶ added in v0.5.0

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

MuxConn is able to multiplex multiple streams on top of any io.ReadWriteCloser. These streams act like TCP connections (Dial, Accept, Close, full duplex, etc.).

The underlying io.ReadWriteCloser is expected to guarantee delivery and ordering, such as TCP. Congestion control and such aren't implemented by the streams, so that is also up to the underlying connection.

MuxConn works using a fairly dumb multiplexing technique of simply framing every piece of data sent into a prefix + data format. Streams are established using a subset of the TCP protocol. Only a subset is necessary since we assume ordering on the underlying RWC.

func NewMuxConn ¶ added in v0.5.0

func NewMuxConn(rwc io.ReadWriteCloser) *MuxConn

Create a new MuxConn around any io.ReadWriteCloser.

func (*MuxConn) Accept ¶ added in v0.5.0

func (m *MuxConn) Accept(id uint32) (io.ReadWriteCloser, error)

Accept accepts a multiplexed connection with the given ID. This will block until a request is made to connect.

func (*MuxConn) Close ¶ added in v0.5.0

func (m *MuxConn) Close() error

Close closes the underlying io.ReadWriteCloser. This will also close all streams that are open.

func (*MuxConn) Dial ¶ added in v0.5.0

func (m *MuxConn) Dial(id uint32) (io.ReadWriteCloser, error)

Dial opens a connection to the remote end using the given stream ID. An Accept on the remote end will only work with if the IDs match.

func (*MuxConn) NextId ¶ added in v0.5.0

func (m *MuxConn) NextId() uint32

NextId returns the next available listen stream ID that isn't currently taken.

type PostProcessorConfigureArgs ¶ added in v0.1.4

type PostProcessorConfigureArgs struct {
	Configs []interface{}
}

type PostProcessorProcessResponse ¶

type PostProcessorProcessResponse struct {
	Err      error
	Keep     bool
	StreamId uint32
}

type PostProcessorServer ¶

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

PostProcessorServer wraps a packer.PostProcessor implementation and makes it exportable as part of a Golang RPC server.

func (*PostProcessorServer) Configure ¶

func (p *PostProcessorServer) Configure(args *PostProcessorConfigureArgs, reply *error) error

func (*PostProcessorServer) PostProcess ¶

func (p *PostProcessorServer) PostProcess(streamId uint32, reply *PostProcessorProcessResponse) error

type ProvisionerPrepareArgs ¶

type ProvisionerPrepareArgs struct {
	Configs []interface{}
}

type ProvisionerServer ¶

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

ProvisionerServer wraps a packer.Provisioner implementation and makes it exportable as part of a Golang RPC server.

func (*ProvisionerServer) Cancel ¶ added in v0.3.6

func (p *ProvisionerServer) Cancel(args *interface{}, reply *interface{}) error

func (*ProvisionerServer) Prepare ¶

func (p *ProvisionerServer) Prepare(args *ProvisionerPrepareArgs, reply *error) error

func (*ProvisionerServer) Provision ¶

func (p *ProvisionerServer) Provision(streamId uint32, reply *interface{}) error

type Server ¶ added in v0.5.0

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

Server represents an RPC server for Packer. This must be paired on the other side with a Client.

func NewServer ¶ added in v0.5.0

func NewServer(conn io.ReadWriteCloser) *Server

NewServer returns a new Packer RPC server.

func (*Server) Close ¶ added in v0.5.0

func (s *Server) Close() error

func (*Server) RegisterArtifact ¶ added in v0.5.0

func (s *Server) RegisterArtifact(a packer.Artifact)

func (*Server) RegisterBuild ¶ added in v0.5.0

func (s *Server) RegisterBuild(b packer.Build)

func (*Server) RegisterBuilder ¶ added in v0.5.0

func (s *Server) RegisterBuilder(b packer.Builder)

func (*Server) RegisterCache ¶ added in v0.5.0

func (s *Server) RegisterCache(c packer.Cache)

func (*Server) RegisterCommand ¶ added in v0.5.0

func (s *Server) RegisterCommand(c packer.Command)

func (*Server) RegisterCommunicator ¶ added in v0.5.0

func (s *Server) RegisterCommunicator(c packer.Communicator)

func (*Server) RegisterEnvironment ¶ added in v0.5.0

func (s *Server) RegisterEnvironment(b packer.Environment)

func (*Server) RegisterHook ¶ added in v0.5.0

func (s *Server) RegisterHook(h packer.Hook)

func (*Server) RegisterPostProcessor ¶ added in v0.5.0

func (s *Server) RegisterPostProcessor(p packer.PostProcessor)

func (*Server) RegisterProvisioner ¶ added in v0.5.0

func (s *Server) RegisterProvisioner(p packer.Provisioner)

func (*Server) RegisterUi ¶ added in v0.5.0

func (s *Server) RegisterUi(ui packer.Ui)

func (*Server) Serve ¶ added in v0.5.0

func (s *Server) Serve()

ServeConn serves a single connection over the RPC server. It is up to the caller to obtain a proper io.ReadWriteCloser.

type Stream ¶ added in v0.5.0

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

Stream is a single stream of data and implements io.ReadWriteCloser. A Stream is full-duplex so you can write data as well as read data.

func (*Stream) Close ¶ added in v0.5.0

func (s *Stream) Close() error

func (*Stream) Read ¶ added in v0.5.0

func (s *Stream) Read(p []byte) (int, error)

func (*Stream) Write ¶ added in v0.5.0

func (s *Stream) Write(p []byte) (int, error)

type Ui ¶

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

An implementation of packer.Ui where the Ui is actually executed over an RPC connection.

func (*Ui) Ask ¶

func (u *Ui) Ask(query string) (result string, err error)

func (*Ui) Error ¶

func (u *Ui) Error(message string)

func (*Ui) Machine ¶ added in v0.3.0

func (u *Ui) Machine(t string, args ...string)

func (*Ui) Message ¶

func (u *Ui) Message(message string)

func (*Ui) Say ¶

func (u *Ui) Say(message string)

type UiMachineArgs ¶ added in v0.3.0

type UiMachineArgs struct {
	Category string
	Args     []string
}

The arguments sent to Ui.Machine

type UiServer ¶

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

UiServer wraps a packer.Ui implementation and makes it exportable as part of a Golang RPC server.

func (*UiServer) Ask ¶

func (u *UiServer) Ask(query string, reply *string) (err error)

func (*UiServer) Error ¶

func (u *UiServer) Error(message *string, reply *interface{}) error

func (*UiServer) Machine ¶ added in v0.3.0

func (u *UiServer) Machine(args *UiMachineArgs, reply *interface{}) error

func (*UiServer) Message ¶

func (u *UiServer) Message(message *string, reply *interface{}) error

func (*UiServer) Say ¶

func (u *UiServer) Say(message *string, reply *interface{}) error

Jump to

Keyboard shortcuts

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