Documentation
¶
Overview ¶
Package node opens JSONL durable storage on the local file system, the Go counterpart of Pi's Node JSONL adapter.
Index ¶
- func OpenNodeJsonlStorage(ctx context.Context, directory string, options jsonl.JsonlStorageOptions) (*jsonl.JsonlStorage, error)
- type NodeFileSystem
- func (fileSystem *NodeFileSystem) AbsolutePath(_ context.Context, path string) (string, error)
- func (fileSystem *NodeFileSystem) AppendFile(ctx context.Context, path string, content any) error
- func (fileSystem *NodeFileSystem) CreateDir(ctx context.Context, path string, options *env.CreateDirOptions) error
- func (fileSystem *NodeFileSystem) FlushFile(ctx context.Context, path string) error
- func (fileSystem *NodeFileSystem) JoinPath(_ context.Context, parts []string) (string, error)
- func (fileSystem *NodeFileSystem) ListDir(ctx context.Context, path string) ([]env.FileInfo, error)
- func (fileSystem *NodeFileSystem) ReadBinaryFile(ctx context.Context, path string) ([]byte, error)
- func (fileSystem *NodeFileSystem) Remove(ctx context.Context, path string, options *env.RemoveOptions) error
- func (fileSystem *NodeFileSystem) RenameFile(ctx context.Context, sourcePath, destinationPath string) error
- func (fileSystem *NodeFileSystem) TruncateFile(ctx context.Context, path string, size int64) error
- func (fileSystem *NodeFileSystem) WriteFile(ctx context.Context, path string, content any) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func OpenNodeJsonlStorage ¶
func OpenNodeJsonlStorage( ctx context.Context, directory string, options jsonl.JsonlStorageOptions, ) (*jsonl.JsonlStorage, error)
OpenNodeJsonlStorage opens or creates a JSONL storage directory on the local file system, resolving a relative directory against the process working directory.
Types ¶
type NodeFileSystem ¶
type NodeFileSystem struct {
Cwd string
}
NodeFileSystem is the local file system as JSONL storage uses it. Its operations follow the file half of Pi's NodeExecutionEnv (packages/durable/src/env/node.ts): paths resolve against Cwd, and failures are *env.FileError.
func (*NodeFileSystem) AbsolutePath ¶
AbsolutePath resolves path against Cwd.
func (*NodeFileSystem) AppendFile ¶
AppendFile appends to a file, creating it and its parent directory.
func (*NodeFileSystem) CreateDir ¶
func (fileSystem *NodeFileSystem) CreateDir(ctx context.Context, path string, options *env.CreateDirOptions) error
CreateDir creates a directory; options default to recursive.
func (*NodeFileSystem) FlushFile ¶
func (fileSystem *NodeFileSystem) FlushFile(ctx context.Context, path string) error
FlushFile flushes a file's contents and the metadata needed to retrieve them.
func (*NodeFileSystem) ListDir ¶
ListDir lists a directory's entries without following symbolic links.
func (*NodeFileSystem) ReadBinaryFile ¶
ReadBinaryFile reads a whole file.
func (*NodeFileSystem) Remove ¶
func (fileSystem *NodeFileSystem) Remove(ctx context.Context, path string, options *env.RemoveOptions) error
Remove removes a file or, with Recursive, a tree; Force ignores a missing path.
func (*NodeFileSystem) RenameFile ¶
func (fileSystem *NodeFileSystem) RenameFile(ctx context.Context, sourcePath, destinationPath string) error
RenameFile renames a file, replacing the destination.
func (*NodeFileSystem) TruncateFile ¶
TruncateFile truncates or extends a file to exactly size bytes.