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

rawedit

package
v0.4.1 Latest Latest
Warning

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

Go to latest
Published: Oct 7, 2026 License: MIT Imports: 7 Imported by: 0

Documentation

Overview

Package rawedit loads and updates complete managed AsciiDoc documents. Source bytes are preserved apart from the managed update timestamp. Domain validation uses the typed codecs, and the index remains a derived projection.

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrConflict means the vault no longer matches the caller's source snapshot.
	ErrConflict = errors.New("note changed in the vault while editing")
	// ErrIndexUpdate means the source was saved but its projection needs a retry.
	ErrIndexUpdate = errors.New("document saved but index update failed")
)

Functions

This section is empty.

Types

type GetHandler

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

GetHandler checks identity and header metadata without requiring a valid body.

func NewGetHandler

func NewGetHandler(store ports.NoteStore, decoder ports.RawNoteCodec) *GetHandler

NewGetHandler creates the raw-source reader with its storage and codec.

func (*GetHandler) Handle

func (handler *GetHandler) Handle(ctx context.Context, query GetQuery) (GetResult, error)

Handle loads source and inspects its identity without requiring a valid document body.

type GetQuery

type GetQuery struct {
	ID string
}

GetQuery identifies the source document to open in an external editor.

type GetResult

type GetResult struct {
	Note ports.Note
	Kind ports.NoteKind
}

GetResult includes the exact source and the kind declared in its header.

type UpdateCommand

type UpdateCommand struct {
	ID   string
	Kind ports.NoteKind

	// Original is the exact source read at load time or returned after a partial save.
	Original []byte
	Source   []byte

	// IndexOnly retries a failed projection of Original without writing the file.
	IndexOnly bool
}

UpdateCommand submits complete source against the last known vault snapshot. Protected identity and creation metadata must remain unchanged.

type UpdateHandler

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

UpdateHandler validates and saves source bytes, then updates their projection. File persistence and index repair are separate stages with distinct outcomes.

func NewUpdateHandler

func NewUpdateHandler(store ports.NoteStore, codec ports.RawNoteCodec, index ports.Index) *UpdateHandler

NewUpdateHandler creates the raw-source writer with its storage, codec and index.

func (*UpdateHandler) Handle

func (handler *UpdateHandler) Handle(ctx context.Context, command UpdateCommand) (UpdateResult, error)

Handle checks the source snapshot and protected metadata before saving and projecting. IndexOnly retries projection without changing source bytes or the update timestamp.

type UpdateResult

type UpdateResult struct {
	// Changed marks a persisted edit or an indexing retry, rather than a no-op.
	Changed bool

	// Note is available after a no-op, a source write or an index-only retry.
	Note ports.Note

	// IndexPending is true only when the file is saved but projection failed.
	IndexPending bool
}

UpdateResult reports the authoritative source even when indexing fails. Callers must retain that snapshot before retrying an IndexPending result.

Jump to

Keyboard shortcuts

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