package
0.0.0-20241030124057-ec13a72a73b2
Repository: https://github.com/weka/go-cloud-lib.git
Documentation: pkg.go.dev
# README
This is a copy of golang.org/x/tools/internal/jsonrpc2 575de47986ce07f39826bf8d5e365d5ebf51ee63 (tree hash: 69698c9f1c72f0834a343c74928885d6e5910534) Grabbed from https://go.googlesource.com/tools/+archive/refs/heads/release-branch.go1.14/internal/jsonrpc2.tar.gz
It is copied directly and not vendored because it is an internal package.
According to https://github.com/golang/go/issues/31080 (x/tools/gopls: make jsonrpc2, lsp, span and friends non-internal), jsonrpc2 might have been refactored outside but they've decided against it.
Weka changes:
- modified to use string IDs.
- cherry-pick 8fe064f891f2084bc046f3ebf13b0c2258993b8c, 88be01311a71af0cda63cfee99fafd9f44e84fe1 (internal/jsonrpc2: fix races in cancellation)
# Functions
NewConn creates a new connection object around the supplied stream.
NewErrorf builds a Error struct for the supplied message and code.
NewHeaderStream returns a Stream built on top of an io.Reader and io.Writer The messages are sent with HTTP content length and MIME type headers.
NewStream returns a Stream built on top of an io.Reader and io.Writer The messages are sent with no wrapping, and rely on json decode consistency to determine message boundaries.
# Constants
CodeInternalError is not currently returned but defined for completeness.
CodeInvalidParams should be returned by the handler when method parameter(s) were invalid.
CodeInvalidRequest is used when the JSON sent is not a valid Request object.
CodeMethodNotFound should be returned by the handler when the method does not exist / is not available.
CodeParseError is used when invalid JSON was received by the server.
CodeServerOverloaded is returned when a message was refused due to aserver being temporarily unable to accept any new messages.
CodeUnknownError should be used for all non coded errors.
Receive indicates the message is incoming.
Send indicates the message is outgoing.
# Structs
Conn is a JSON RPC 2 client server connection.
No description provided by the author
Error represents a structured error in a Response.
ID is a Request identifier.
Request is sent to a server to represent a Call or Notify operaton.
VersionTag is a special 0 sized struct that encodes as the jsonrpc version tag.
WireRequest is sent to a server to represent a Call or Notify operaton.
WireResponse is a reply to a Request.
# Type aliases
Direction is used to indicate to a logger whether the logged message was being sent or received.