Help us shape the future of Go! Take the 2026 Go Developer Survey

ipc

package
v0.8.1 Latest Latest
Warning

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

Go to latest
Published: Oct 20, 2026 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Overview

Package ipc is locksql's console protocol: lockkit's transport and methods (package lockkit/ipc, re-exported here under the same names) plus the SQL methods and their types.

Index

Constants

View Source
const (
	MethodHello           = kipc.MethodHello
	MethodStatus          = kipc.MethodStatus
	MethodCatalogList     = "catalog.list"
	MethodCatalogDescribe = "catalog.describe"
	MethodQueryPlan       = "query.plan"
	MethodQueryRun        = "query.run"
	MethodPIIList         = kipc.MethodPIIList
	MethodPIIAdd          = kipc.MethodPIIAdd
	MethodChangeRequest   = kipc.MethodChangeRequest
	MethodLogout          = kipc.MethodLogout
)

Methods, spec §7. None of them loosens policy: change.request only queues a proposal that the console shows to the human.

View Source
const (
	CodeRefused       = kipc.CodeRefused
	CodeDenied        = kipc.CodeDenied
	CodeTimeout       = kipc.CodeTimeout
	CodeNoSuchPlan    = kipc.CodeNoSuchPlan
	CodeConnLost      = kipc.CodeConnLost
	CodePolicyPending = kipc.CodePolicyPending

	CodeParseError     = kipc.CodeParseError
	CodeInvalidRequest = kipc.CodeInvalidRequest
	CodeMethodNotFound = kipc.CodeMethodNotFound
	CodeInvalidParams  = kipc.CodeInvalidParams
	CodeInternal       = kipc.CodeInternal
)

Error codes (lockkit's).

View Source
const MaxIntent = 200

MaxIntent bounds PlanParams.Intent.

View Source
const MaxMessage = kipc.MaxMessage

MaxMessage is the largest message, excluding the newline, in bytes.

View Source
const ProtocolMajor = kipc.ProtocolMajor

ProtocolMajor is exchanged in the hello handshake.

Variables

View Source
var (
	ErrTooLarge       = kipc.ErrTooLarge
	ErrAlreadyRunning = kipc.ErrAlreadyRunning

	Compatible       = kipc.Compatible
	WriteMsg         = kipc.WriteMsg
	ReadMsg          = kipc.ReadMsg
	Listen           = kipc.Listen
	PeerCred         = kipc.PeerCred
	PeerAllowed      = kipc.PeerAllowed
	SharedSocketPath = kipc.SharedSocketPath
)
View Source
var RuntimeDirEnv = product.P.RuntimeDirEnv()

RuntimeDirEnv overrides the runtime dir of locksql's sockets (LOCKSQL_RUNTIME_DIR).

Functions

func ListenShared

func ListenShared(path string, gid int) (net.Listener, error)

ListenShared opens locksql's console socket in the shared directory.

func Methods

func Methods() []string

Methods lists every method name.

func SocketPath

func SocketPath(projectHash, profile string) (string, error)

SocketPath is locksql's console socket of a project and profile.

Types

type ChangeParams

type ChangeParams = kipc.ChangeParams

lockkit's method types.

type ChangeResult

type ChangeResult = kipc.ChangeResult

lockkit's method types.

type Cred

type Cred = kipc.Cred

lockkit's transport.

type DescribeParams

type DescribeParams struct {
	DB    string `json:"db"`
	Table string `json:"table"`
}

DescribeParams describes one table (catalog.describe); the result is an engine.TableInfo.

type Health

type Health struct {
	// Separated is set when the console runs as a dedicated account,
	// apart from the agent (sysconf).
	Separated bool   `json:"separated"`
	Display   string `json:"display"`
	// Privileges are the privilege audit's findings: what the database
	// account can do beyond the profile tier.
	Privileges []string `json:"privileges"`
	// ExplainOK reports that EXPLAIN works on the server.
	ExplainOK bool `json:"explain_ok"`
	// ReadOnly reports that the session is read-only on the server.
	ReadOnly bool `json:"read_only"`
}

Health is the console's own diagnosis of its setup.

type HelloParams

type HelloParams = kipc.HelloParams

lockkit's method types.

type HelloResult

type HelloResult = kipc.HelloResult

lockkit's method types.

type PIIAddParams

type PIIAddParams = kipc.PIIAddParams

lockkit's method types.

type PIIListResult

type PIIListResult = kipc.PIIListResult

lockkit's method types.

type PlanParams

type PlanParams struct {
	DB     string `json:"db"`
	SQL    string `json:"sql"`
	Unmask bool   `json:"unmask,omitempty"`
	// Intent is one line from the agent saying why the query is needed,
	// shown to the human on the approval screen and audited. It is
	// untrusted text of at most MaxIntent bytes.
	Intent string `json:"intent,omitempty"`
}

PlanParams asks for a plan (classification, EXPLAIN, weight, approval).

type PlanResult

type PlanResult struct {
	PlanID  string   `json:"plan_id"`
	Profile string   `json:"profile"`
	Host    string   `json:"host"`
	DB      string   `json:"db"`
	SQL     string   `json:"sql"`
	Class   string   `json:"class"`
	Verdict string   `json:"verdict"`
	Summary string   `json:"summary"`
	Reasons []string `json:"reasons,omitempty"`
	Unmask  bool     `json:"unmask,omitempty"`
	// Values are the placeholder names the human typed in this console
	// session: '${name}' reuses a value without a prompt.
	Values []string `json:"values,omitempty"`
}

PlanResult is an approved, one-shot plan.

type RPCError

type RPCError = kipc.RPCError

lockkit's transport.

type Request

type Request = kipc.Request

lockkit's transport.

type Response

type Response = kipc.Response

lockkit's transport.

type RunParams

type RunParams struct {
	PlanID string `json:"plan_id"`
}

RunParams runs an approved plan.

type RunResult

type RunResult struct {
	Columns   []string `json:"columns"`
	Rows      [][]any  `json:"rows"`
	Truncated bool     `json:"truncated"`
	Affected  int64    `json:"affected,omitempty"`
	// CutCells counts the cells whose value was cut (it ends with "…"):
	// longer than max_cell_chars, or than the engine's per-cell cap.
	CutCells int `json:"cut_cells,omitempty"`
	// DurationMS is no longer filled: timings stay on the console.
	DurationMS int64  `json:"duration_ms,omitempty"`
	Text       string `json:"text,omitempty"`
}

RunResult is a capped, masked result. Text is the rendered TSV.

type StatusResult

type StatusResult struct {
	Profile        string        `json:"profile"`
	Engine         string        `json:"engine"`
	Host           string        `json:"host"`
	HostConfirmed  bool          `json:"host_confirmed"`
	Production     bool          `json:"production"`
	AutoApprove    bool          `json:"auto_approve"`
	AllowUnmask    bool          `json:"allow_unmask"`
	ShowResults    bool          `json:"show_results"`
	Tier           string        `json:"tier"`
	Databases      []string      `json:"databases"`
	Limits         config.Limits `json:"limits"`
	IdleTimeoutInS int           `json:"idle_timeout_in_s"`
	SessionEndsInS int           `json:"session_ends_in_s"`
	// Health is what the console found at start-up, for locksql doctor.
	Health *Health `json:"health,omitempty"`
}

StatusResult describes the console session.

type TablesParams

type TablesParams struct {
	DB string `json:"db"`
}

TablesParams lists the tables of a database (catalog.list).

type TablesResult

type TablesResult struct {
	DB     string   `json:"db"`
	Tables []string `json:"tables"`
}

TablesResult answers catalog.list.

Jump to

Keyboard shortcuts

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