Documentation
¶
Overview ¶
Package store is the mechanism layer: append-only JSONL channels on disk. One channel is one file under the store dir; a message is one JSON line. Appends are a single write(2) on an O_APPEND descriptor under an exclusive flock, so concurrent writers never interleave within a line. Readers take no lock at all — they resume from an opaque cursor (a byte offset) and stop cleanly at a torn final line.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ( ErrBadName = errors.New("invalid channel name: use letters, digits, dot, dash, underscore (max 64)") ErrChannelNotFound = errors.New("channel not found") ErrBadCursor = errors.New("invalid cursor") ErrEmptyFrom = errors.New("from is required") ErrEmptyBody = errors.New("body is required") )
Sentinel errors callers branch on. Everything else is an internal failure.
Functions ¶
This section is empty.
Types ¶
type Info ¶
type Info struct {
Name string `json:"name"`
LastActivity time.Time `json:"lastActivity"`
SizeBytes int64 `json:"sizeBytes"`
}
Info summarizes one channel for listings.
type Message ¶
type Message struct {
TS time.Time `json:"ts"`
From string `json:"from"`
Body string `json:"body"`
}
Message is one line of a channel: who said what, when.
type Store ¶
type Store struct {
// contains filtered or unexported fields
}
Store reads and appends channels under a single directory.
func (*Store) Post ¶
Post appends one message to the named channel, creating the channel on first post. It returns the stored message with its server-side timestamp.