Documentation
¶
Overview ¶
Package leyline provides Go bindings to the ley-line C FFI.
The actual implementation requires the "leyline" build tag and a locally built libleyline_fs.a. See client.go for details.
Index ¶
- func DiscoverOrStart() (string, error)
- func DiscoverSocket() (string, error)
- func StopManaged()
- type SocketClient
- func (c *SocketClient) Close() error
- func (c *SocketClient) Query(sql string) ([][]any, error)
- func (c *SocketClient) SendOp(req map[string]any) (map[string]any, error)
- func (c *SocketClient) SetDeadline(t time.Time) error
- func (c *SocketClient) Tool(name string, args map[string]any) (map[string]any, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DiscoverOrStart ¶
DiscoverOrStart finds a running ley-line daemon socket, or auto-starts a managed daemon subprocess if the leyline binary is on PATH.
The managed daemon uses ~/.mache/ as its data directory:
~/.mache/default.arena — arena file ~/.mache/default.ctrl — control block ~/.mache/default.sock — UDS socket (what we connect to) ~/.mache/mount/ — FUSE/NFS mount point
The subprocess is killed when the mache process exits (via atexit cleanup registered on first spawn). Only one managed daemon per process.
func DiscoverSocket ¶
DiscoverSocket finds the ley-line socket path by checking:
- LEYLINE_SOCKET environment variable
- ~/.mache/default.sock (well-known kiln deployment path)
Returns the path and nil error if a socket file exists, or an error if no socket can be found. Does NOT auto-start a daemon.
func StopManaged ¶
func StopManaged()
StopManaged kills the auto-spawned leyline daemon, if any. Safe to call multiple times. Called automatically by cleanup hooks.
Types ¶
type SocketClient ¶
type SocketClient struct {
// contains filtered or unexported fields
}
SocketClient communicates with a running ley-line daemon over its Unix domain control socket ({ctrl}.sock).
func DialSocket ¶
func DialSocket(sockPath string) (*SocketClient, error)
DialSocket connects to the ley-line control socket at sockPath. The socket path is typically derived from the control path: e.g. /tmp/leyline.ctrl → /tmp/leyline.sock
func (*SocketClient) Close ¶
func (c *SocketClient) Close() error
Close closes the underlying connection. Safe to call multiple times.
func (*SocketClient) Query ¶
func (c *SocketClient) Query(sql string) ([][]any, error)
Query runs a SQL query against the active arena buffer via the `query` op. Returns the rows as [][]any.
func (*SocketClient) SendOp ¶
SendOp sends a JSON request and reads the JSON response. Both are line-delimited (newline-terminated JSON).
func (*SocketClient) SetDeadline ¶
func (c *SocketClient) SetDeadline(t time.Time) error
SetDeadline sets the read/write deadline on the underlying connection.