serve

package
v0.13.1 Latest Latest
Warning

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

Go to latest
Published: Jun 13, 2026 License: MIT Imports: 4 Imported by: 0

Documentation

Overview

Package serve implements the NDJSON JSON-RPC 2.0 framing layer for `repomap serve`. One JSON object per line; no Content-Length headers.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Codec

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

Codec is a single-connection NDJSON framing layer. ReadMessage is NOT safe for concurrent use; it belongs to the read goroutine. WriteMessage is protected by writeMu and is safe for concurrent use.

func NewCodec

func NewCodec(r io.Reader, w io.Writer) *Codec

NewCodec wraps r and w in an NDJSON codec. The scanner accepts lines up to 4 MB (64 KB initial buffer).

func (*Codec) ReadMessage

func (c *Codec) ReadMessage(v any) error

ReadMessage reads one JSON-RPC message from the reader. Returns io.EOF when the input stream is exhausted. Not safe for concurrent use.

func (*Codec) WriteMessage

func (c *Codec) WriteMessage(v any) error

WriteMessage serialises v as a single JSON line. Safe for concurrent use.

Jump to

Keyboard shortcuts

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