buse

package
v9.0.0+incompatible Latest Latest
Warning

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

Go to latest
Published: Nov 8, 2017 License: MIT Imports: 9 Imported by: 0

README

buse

buse (butler service) is a JSON-RPC 2.0 service over TCP that allows using butler for long-running tasks (called operations) or one-off requests.

Usage

Start butler in service mode:

butler service --json

It'll output a line of JSON similar to this one:

{"time":1509722356,"type":"result","value":{"address":"127.0.0.1:50890","type":"server-listening"}}

Dial the address to establish a connection, then send \n-separated valid JSON-RPC 2.0 requests or notifications. The connection is bidirectional, so butler may send requests and notifications the other way.

Note: most JSON-RPC 2.0 implementations assume a unidirectional use-case, ie. client/server. These won't work with buse.

When you're done, just kill the butler process.

Methods

There is no human documentation for buse, save for this README.

All requests, notifications and results can be found in the types.go file.

Client libraries

While JSON-RPC 2.0 and TCP are simple (unlike, say, grpc), it's sometimes more convenient to use client libraries and get straight to the point.

node.js client library

node-buse is used by the itch.io app to access buse from the node.js runtime. It has very few dependencies and ships with TypeScript typings so that all requests/notifications/results are type-checked by the compiler.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type GameCredentials

type GameCredentials struct {
	Server      string `json:"server"`
	APIKey      string `json:"apiKey"`
	DownloadKey int64  `json:"downloadKey"`
}

GameCredentials contains all the credentials required to make API requests including the download key if any

type InstallParams

type InstallParams struct {
	Game          *itchio.Game     `json:"game"`
	InstallFolder string           `json:"installFolder"`
	Upload        *itchio.Upload   `json:"upload"`
	Build         *itchio.Build    `json:"build"`
	Credentials   *GameCredentials `json:"credentials"`
}

InstallParams contains all the parameters needed to perform an installation for a game

type LFObjectCodec

type LFObjectCodec struct{}

func (LFObjectCodec) ReadObject

func (LFObjectCodec) ReadObject(stream *bufio.Reader, v interface{}) error

func (LFObjectCodec) WriteObject

func (LFObjectCodec) WriteObject(stream io.Writer, obj interface{}) error

type LogNotification

type LogNotification struct {
	Level   string `json:"level"`
	Message string `json:"message"`
}

Log

type OperationProgressNotification

type OperationProgressNotification struct {
	Progress float64 `json:"progress"`
	ETA      float64 `json:"eta,omitempty"`
	BPS      int64   `json:"bps,omitempty"`
}

Operation.Progress Sent periodically to inform on the current state an operation

type OperationResult

type OperationResult struct {
	Success       bool        `json:"success"`
	InstallResult interface{} `json:"installResult,omitempty"`
	ErrorMessage  string      `json:"errorMessage,omitempty"`
	ErrorStack    string      `json:"errorStack,omitempty"`
}

Result for

  • Operation.Start
  • Operation.Resume

type OperationResumeParams

type OperationResumeParams struct {
	StagingFolder string `json:"stagingFolder"`
}

Operation.Resume

type OperationStartParams

type OperationStartParams struct {
	StagingFolder string         `json:"stagingFolder"`
	Operation     string         `json:"operation"`
	InstallParams *InstallParams `json:"installParams,omitempty"`
}

Operation.Start

type PickUploadParams

type PickUploadParams struct {
	Uploads []*itchio.Upload `json:"uploads"`
}

type PickUploadResult

type PickUploadResult struct {
	Index int64 `json:"index"`
}

type Server

type Server struct {
}

func NewServer

func NewServer() *Server

func (*Server) Serve

func (s *Server) Serve(ctx context.Context, lis net.Listener, h jsonrpc2.Handler, opt ...jsonrpc2.ConnOpt) error

type TestDoubleRequest

type TestDoubleRequest struct {
	Number int64 `json:"number"`
}

Test.Double

type TestDoubleResult

type TestDoubleResult struct {
	Number int64 `json:"number"`
}

Result for Test.Double

type TestDoubleTwiceRequest

type TestDoubleTwiceRequest struct {
	Number int64 `json:"number"`
}

Test.DoubleTwice

type TestDoubleTwiceResult

type TestDoubleTwiceResult struct {
	Number int64 `json:"number"`
}

Result for Test.DoubleTwice

type VersionGetParams

type VersionGetParams struct{}

Version.Get

type VersionGetResult

type VersionGetResult struct {
	// Something short, like `v8.0.0`
	Version string `json:"version"`

	// Something long, like `v8.0.0, built on Aug 27 2017 @ 01:13:55, ref d833cc0aeea81c236c81dffb27bc18b2b8d8b290`
	VersionString string `json:"versionString"`
}

Result for Version.Get

Jump to

Keyboard shortcuts

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