state

package
v0.0.0-...-c5aa536 Latest Latest
Warning

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

Go to latest
Published: Nov 28, 2025 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ComputeHash

func ComputeHash(path string) (string, error)

ComputeHash computes SHA256 hash of a file

Types

type FileState

type FileState struct {
	MTime      int64  `json:"mtime"`
	Hash       string `json:"hash"`
	PairedWith string `json:"paired_with"`
}

FileState represents the state of a single file

type State

type State struct {
	Files map[string]*FileState `json:"files"`
	IDMap map[string]string     `json:"id_map"` // org-id -> filename
}

State represents the sync state

func Load

func Load(path string) (*State, error)

Load reads state from the state file

func NewState

func NewState() *State

NewState creates a new empty state

func (*State) GetMTime

func (s *State) GetMTime(path string) time.Time

GetMTime returns the modification time for a file

func (*State) HasChanged

func (s *State) HasChanged(path string) (bool, error)

HasChanged checks if a file has changed since last sync Uses hybrid mtime + hash approach

func (*State) Save

func (s *State) Save(path string) error

Save writes state to the state file

func (*State) Update

func (s *State) Update(path string, pairedWith string) error

Update updates the state for a file

Jump to

Keyboard shortcuts

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