Skip to main content

agents/anchor-edge-agent/internal/buffer/file_buffer.go

Metadata

Indexed Symbols

  • NewFileBuffer (line 17, go function) - Implements new file buffer for module behavior.
  • Append (line 29, go function) - Implements append for module behavior.
  • ReadAll (line 45, go function) - Implements read all for module behavior.
  • Clear (line 74, go function) - Implements clear for module behavior.

Markdown Headings (if applicable)

No markdown headings detected.

Source Preview

package buffer

import (
"bufio"
"encoding/json"
"errors"
"os"
"path/filepath"

"github.com/anchor-msp/anchor-edge-agent/internal/types"
)

type FileBuffer struct {
path string
}

func NewFileBuffer(path string) (*FileBuffer, error) {
if path == "" {
return nil, errors.New("buffer path is required")
}

if err := os.MkdirAll(filepath.Dir(path), 0o750); err != nil {
return nil, err
}