rpcplugin

package
v4.3.0-rc2+incompatible Latest Latest
Warning

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

Go to latest
Published: Oct 11, 2017 License: AGPL-3.0, Apache-2.0 Imports: 21 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ConnectIOReader

func ConnectIOReader(conn io.ReadWriteCloser) io.ReadCloser

func InheritedIPC

func InheritedIPC(fd0, fd1 uintptr) (io.ReadWriteCloser, error)

Returns the IPC instance inherited by the process from its parent.

func InheritedProcessIPC

func InheritedProcessIPC() (io.ReadWriteCloser, error)

When called on a process launched with NewProcess, returns the inherited IPC.

func Main

func Main(hooks interface{})

Makes a set of hooks available via RPC. This function never returns.

func NewAsyncReadCloser

func NewAsyncReadCloser(r io.ReadCloser) io.ReadCloser

NewAsyncReadCloser returns a ReadCloser that supports Close during Read.

func NewAsyncWriteCloser

func NewAsyncWriteCloser(w io.WriteCloser) io.WriteCloser

NewAsyncWriteCloser returns a WriteCloser that supports Close during Write.

func NewIPC

func NewIPC() (io.ReadWriteCloser, []*os.File, error)

Returns a new IPC for the parent process and a set of files to pass on to the child.

The returned files must be closed after the child process is started.

func NewReadWriteCloser

func NewReadWriteCloser(r io.ReadCloser, w io.WriteCloser) io.ReadWriteCloser

func ServeAPI

func ServeAPI(api plugin.API, conn io.ReadWriteCloser, muxer *Muxer)

func ServeHTTPResponseWriter

func ServeHTTPResponseWriter(w http.ResponseWriter, conn io.ReadWriteCloser)

func ServeHooks

func ServeHooks(hooks interface{}, conn io.ReadWriteCloser, muxer *Muxer)

func ServeIOReader

func ServeIOReader(r io.Reader, conn io.ReadWriteCloser)

func SupervisorProvider

func SupervisorProvider(bundle *model.BundleInfo) (plugin.Supervisor, error)

Types

type APIChannelReply

type APIChannelReply struct {
	Channel *model.Channel
	Error   *model.AppError
}

type APIErrorReply

type APIErrorReply struct {
	Error *model.AppError
}

type APIGetChannelByNameArgs

type APIGetChannelByNameArgs struct {
	Name   string
	TeamId string
}

type APIGetDirectChannelArgs

type APIGetDirectChannelArgs struct {
	UserId1 string
	UserId2 string
}

type APIGetGroupChannelArgs

type APIGetGroupChannelArgs struct {
	UserIds []string
}

type APIPostReply

type APIPostReply struct {
	Post  *model.Post
	Error *model.AppError
}

type APITeamReply

type APITeamReply struct {
	Team  *model.Team
	Error *model.AppError
}

type APIUserReply

type APIUserReply struct {
	User  *model.User
	Error *model.AppError
}

type LocalAPI

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

func (*LocalAPI) CreateChannel

func (api *LocalAPI) CreateChannel(args *model.Channel, reply *APIChannelReply) error

func (*LocalAPI) CreatePost

func (api *LocalAPI) CreatePost(args *model.Post, reply *APIPostReply) error

func (*LocalAPI) CreateTeam

func (api *LocalAPI) CreateTeam(args *model.Team, reply *APITeamReply) error

func (*LocalAPI) CreateUser

func (api *LocalAPI) CreateUser(args *model.User, reply *APIUserReply) error

func (*LocalAPI) DeleteChannel

func (api *LocalAPI) DeleteChannel(args string, reply *APIErrorReply) error

func (*LocalAPI) DeletePost

func (api *LocalAPI) DeletePost(args string, reply *APIErrorReply) error

func (*LocalAPI) DeleteTeam

func (api *LocalAPI) DeleteTeam(args string, reply *APIErrorReply) error

func (*LocalAPI) DeleteUser

func (api *LocalAPI) DeleteUser(args string, reply *APIErrorReply) error

func (*LocalAPI) GetChannel

func (api *LocalAPI) GetChannel(args string, reply *APIChannelReply) error

func (*LocalAPI) GetChannelByName

func (api *LocalAPI) GetChannelByName(args *APIGetChannelByNameArgs, reply *APIChannelReply) error

func (*LocalAPI) GetDirectChannel

func (api *LocalAPI) GetDirectChannel(args *APIGetDirectChannelArgs, reply *APIChannelReply) error

func (*LocalAPI) GetGroupChannel

func (api *LocalAPI) GetGroupChannel(args *APIGetGroupChannelArgs, reply *APIChannelReply) error

func (*LocalAPI) GetPost

func (api *LocalAPI) GetPost(args string, reply *APIPostReply) error

func (*LocalAPI) GetTeam

func (api *LocalAPI) GetTeam(args string, reply *APITeamReply) error

func (*LocalAPI) GetTeamByName

func (api *LocalAPI) GetTeamByName(args string, reply *APITeamReply) error

func (*LocalAPI) GetUser

func (api *LocalAPI) GetUser(args string, reply *APIUserReply) error

func (*LocalAPI) GetUserByEmail

func (api *LocalAPI) GetUserByEmail(args string, reply *APIUserReply) error

func (*LocalAPI) GetUserByUsername

func (api *LocalAPI) GetUserByUsername(args string, reply *APIUserReply) error

func (*LocalAPI) LoadPluginConfiguration

func (api *LocalAPI) LoadPluginConfiguration(args struct{}, reply *[]byte) error

func (*LocalAPI) UpdateChannel

func (api *LocalAPI) UpdateChannel(args *model.Channel, reply *APIChannelReply) error

func (*LocalAPI) UpdatePost

func (api *LocalAPI) UpdatePost(args *model.Post, reply *APIPostReply) error

func (*LocalAPI) UpdateTeam

func (api *LocalAPI) UpdateTeam(args *model.Team, reply *APITeamReply) error

func (*LocalAPI) UpdateUser

func (api *LocalAPI) UpdateUser(args *model.User, reply *APIUserReply) error

type LocalHTTPResponseWriter

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

func (*LocalHTTPResponseWriter) Header

func (w *LocalHTTPResponseWriter) Header(args struct{}, reply *http.Header) error

func (*LocalHTTPResponseWriter) SyncHeader

func (w *LocalHTTPResponseWriter) SyncHeader(args http.Header, reply *struct{}) error

func (*LocalHTTPResponseWriter) Write

func (w *LocalHTTPResponseWriter) Write(args []byte, reply *struct{}) error

func (*LocalHTTPResponseWriter) WriteHeader

func (w *LocalHTTPResponseWriter) WriteHeader(args int, reply *struct{}) error

type LocalHooks

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

func (*LocalHooks) Implemented

func (h *LocalHooks) Implemented(args struct{}, reply *[]string) error

Implemented replies with the names of the hooks that are implemented.

func (*LocalHooks) OnActivate

func (h *LocalHooks) OnActivate(args int64, reply *struct{}) error

func (*LocalHooks) OnConfigurationChange

func (h *LocalHooks) OnConfigurationChange(args, reply *struct{}) error

func (*LocalHooks) OnDeactivate

func (h *LocalHooks) OnDeactivate(args, reply *struct{}) (err error)

func (*LocalHooks) ServeHTTP

func (h *LocalHooks) ServeHTTP(args ServeHTTPArgs, reply *struct{}) error

type Muxer

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

Muxer allows multiple bidirectional streams to be transmitted over a single connection.

Muxer is safe for use by multiple goroutines.

Streams opened on the muxer must be periodically drained in order to reclaim read buffer memory. In other words, readers must consume incoming data as it comes in.

func NewMuxer

func NewMuxer(conn io.ReadWriteCloser, parity bool) *Muxer

Creates a new Muxer.

conn must be safe for simultaneous reads by one goroutine and writes by another.

For two muxers communicating with each other via a connection, parity must be true for exactly one of them.

func (*Muxer) Close

func (m *Muxer) Close() error

Closes the muxer.

func (*Muxer) Connect

func (m *Muxer) Connect(id int64) io.ReadWriteCloser

Opens a remotely opened stream.

func (*Muxer) IsClosed

func (m *Muxer) IsClosed() bool

func (*Muxer) Read

func (m *Muxer) Read(p []byte) (int, error)

Calling Read on the muxer directly performs a read on a dedicated, always-open channel.

func (*Muxer) Serve

func (m *Muxer) Serve() (int64, io.ReadWriteCloser)

Opens a new stream with a unique id.

Writes made to the stream before the other end calls Connect will be discarded.

func (*Muxer) Write

func (m *Muxer) Write(p []byte) (int, error)

Calling Write on the muxer directly performs a write on a dedicated, always-open channel.

type Process

type Process interface {
	// Waits for the process to exit and returns an error if a problem occurred or the process exited
	// with a non-zero status.
	Wait() error
}

func NewProcess

func NewProcess(ctx context.Context, path string) (Process, io.ReadWriteCloser, error)

NewProcess launches an RPC executable in a new process and returns an IPC that can be used to communicate with it.

type RemoteAPI

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

func ConnectAPI

func ConnectAPI(conn io.ReadWriteCloser, muxer *Muxer) *RemoteAPI

func (*RemoteAPI) Close

func (h *RemoteAPI) Close() error

func (*RemoteAPI) CreateChannel

func (api *RemoteAPI) CreateChannel(channel *model.Channel) (*model.Channel, *model.AppError)

func (*RemoteAPI) CreatePost

func (api *RemoteAPI) CreatePost(post *model.Post) (*model.Post, *model.AppError)

func (*RemoteAPI) CreateTeam

func (api *RemoteAPI) CreateTeam(team *model.Team) (*model.Team, *model.AppError)

func (*RemoteAPI) CreateUser

func (api *RemoteAPI) CreateUser(user *model.User) (*model.User, *model.AppError)

func (*RemoteAPI) DeleteChannel

func (api *RemoteAPI) DeleteChannel(channelId string) *model.AppError

func (*RemoteAPI) DeletePost

func (api *RemoteAPI) DeletePost(postId string) *model.AppError

func (*RemoteAPI) DeleteTeam

func (api *RemoteAPI) DeleteTeam(teamId string) *model.AppError

func (*RemoteAPI) DeleteUser

func (api *RemoteAPI) DeleteUser(userId string) *model.AppError

func (*RemoteAPI) GetChannel

func (api *RemoteAPI) GetChannel(channelId string) (*model.Channel, *model.AppError)

func (*RemoteAPI) GetChannelByName

func (api *RemoteAPI) GetChannelByName(name, teamId string) (*model.Channel, *model.AppError)

func (*RemoteAPI) GetDirectChannel

func (api *RemoteAPI) GetDirectChannel(userId1, userId2 string) (*model.Channel, *model.AppError)

func (*RemoteAPI) GetGroupChannel

func (api *RemoteAPI) GetGroupChannel(userIds []string) (*model.Channel, *model.AppError)

func (*RemoteAPI) GetPost

func (api *RemoteAPI) GetPost(postId string) (*model.Post, *model.AppError)

func (*RemoteAPI) GetTeam

func (api *RemoteAPI) GetTeam(teamId string) (*model.Team, *model.AppError)

func (*RemoteAPI) GetTeamByName

func (api *RemoteAPI) GetTeamByName(name string) (*model.Team, *model.AppError)

func (*RemoteAPI) GetUser

func (api *RemoteAPI) GetUser(userId string) (*model.User, *model.AppError)

func (*RemoteAPI) GetUserByEmail

func (api *RemoteAPI) GetUserByEmail(email string) (*model.User, *model.AppError)

func (*RemoteAPI) GetUserByUsername

func (api *RemoteAPI) GetUserByUsername(name string) (*model.User, *model.AppError)

func (*RemoteAPI) LoadPluginConfiguration

func (api *RemoteAPI) LoadPluginConfiguration(dest interface{}) error

func (*RemoteAPI) UpdateChannel

func (api *RemoteAPI) UpdateChannel(channel *model.Channel) (*model.Channel, *model.AppError)

func (*RemoteAPI) UpdatePost

func (api *RemoteAPI) UpdatePost(post *model.Post) (*model.Post, *model.AppError)

func (*RemoteAPI) UpdateTeam

func (api *RemoteAPI) UpdateTeam(team *model.Team) (*model.Team, *model.AppError)

func (*RemoteAPI) UpdateUser

func (api *RemoteAPI) UpdateUser(user *model.User) (*model.User, *model.AppError)

type RemoteHTTPResponseWriter

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

func ConnectHTTPResponseWriter

func ConnectHTTPResponseWriter(conn io.ReadWriteCloser) *RemoteHTTPResponseWriter

func (*RemoteHTTPResponseWriter) Close

func (h *RemoteHTTPResponseWriter) Close() error

func (*RemoteHTTPResponseWriter) Header

func (w *RemoteHTTPResponseWriter) Header() http.Header

func (*RemoteHTTPResponseWriter) Write

func (w *RemoteHTTPResponseWriter) Write(b []byte) (int, error)

func (*RemoteHTTPResponseWriter) WriteHeader

func (w *RemoteHTTPResponseWriter) WriteHeader(statusCode int)

type RemoteHooks

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

func ConnectHooks

func ConnectHooks(conn io.ReadWriteCloser, muxer *Muxer) (*RemoteHooks, error)

func ConnectMain

func ConnectMain(muxer *Muxer) (*RemoteHooks, error)

Returns the hooks being served by a call to Main.

func (*RemoteHooks) Close

func (h *RemoteHooks) Close() error

func (*RemoteHooks) Implemented

func (h *RemoteHooks) Implemented() (impl []string, err error)

func (*RemoteHooks) OnActivate

func (h *RemoteHooks) OnActivate(api plugin.API) error

func (*RemoteHooks) OnConfigurationChange

func (h *RemoteHooks) OnConfigurationChange() error

func (*RemoteHooks) OnDeactivate

func (h *RemoteHooks) OnDeactivate() error

func (*RemoteHooks) ServeHTTP

func (h *RemoteHooks) ServeHTTP(w http.ResponseWriter, r *http.Request)

type RemoteIOReader

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

func (*RemoteIOReader) Close

func (r *RemoteIOReader) Close() error

func (*RemoteIOReader) Read

func (r *RemoteIOReader) Read(b []byte) (int, error)

type ServeHTTPArgs

type ServeHTTPArgs struct {
	ResponseWriterStream int64
	Request              *http.Request
	RequestBodyStream    int64
}

type Supervisor

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

Supervisor implements a plugin.Supervisor that launches the plugin in a separate process and communicates via RPC.

If the plugin unexpectedly exists, the supervisor will relaunch it after a short delay.

func (*Supervisor) Hooks

func (s *Supervisor) Hooks() plugin.Hooks

Returns the hooks used to communicate with the plugin. The hooks may change if the plugin is restarted, so the return value should not be cached.

func (*Supervisor) Start

func (s *Supervisor) Start() error

Starts the plugin. This method will block until the plugin is successfully launched for the first time and will return an error if the plugin cannot be launched at all.

func (*Supervisor) Stop

func (s *Supervisor) Stop() error

Stops the plugin.

Jump to

Keyboard shortcuts

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