fssync

package
v1.1.2 Latest Latest
Warning

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

Go to latest
Published: Nov 22, 2025 License: MIT Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ApplyOperation

func ApplyOperation(rootDir string, op *FileOperationMessage) error

func BuildFileManifest

func BuildFileManifest(rootDir string, ignorer *PathIgnorer) (map[string]string, error)

func ComputeFileHash

func ComputeFileHash(filePath string) (string, error)

Types

type Client

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

func NewClient

func NewClient(cfg ClientConfig) (*Client, error)

func (*Client) Run

func (c *Client) Run(ctx context.Context)

type ClientConfig

type ClientConfig struct {
	ServerAddr  string
	SyncDir     string
	IgnorePaths string
}

type FileContentMessage

type FileContentMessage struct {
	Path    string `json:"path"`
	Content []byte `json:"content"`
}

type FileOperationMessage

type FileOperationMessage struct {
	Op      OperationType `json:"op"`
	Path    string        `json:"path"`
	Content []byte        `json:"content"`
	IsDir   bool          `json:"is_dir,omitempty"`
}

type FileRequestMessage

type FileRequestMessage struct {
	Paths []string `json:"paths"`
}

type ManifestMessage

type ManifestMessage struct {
	Files map[string]string `json:"files"`
}

type MessageType

type MessageType string
const (
	TypeManifest      MessageType = "manifest"
	TypeFileRequest   MessageType = "file_request"
	TypeFileContent   MessageType = "file_content"
	TypeFileOperation MessageType = "file_operation"
)

type MessageWrapper

type MessageWrapper struct {
	Type    MessageType     `json:"type"`
	Payload json.RawMessage `json:"payload"`
}

type OperationType

type OperationType string
const (
	OpWrite  OperationType = "write"
	OpRemove OperationType = "remove"
)

type PathIgnorer

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

func NewPathIgnorer

func NewPathIgnorer(ignoreStr string) *PathIgnorer

func (*PathIgnorer) IsIgnored

func (pi *PathIgnorer) IsIgnored(path string) bool

type SafeConn

type SafeConn struct {
	Conn *websocket.Conn
	// contains filtered or unexported fields
}

func (*SafeConn) WriteJSON

func (sc *SafeConn) WriteJSON(v any) error

type Server

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

func NewServer

func NewServer(cfg ServerConfig) (*Server, error)

func (*Server) Run

func (s *Server) Run(ctx context.Context) error

type ServerConfig

type ServerConfig struct {
	Port        int
	SyncDir     string
	IgnorePaths string
}

Jump to

Keyboard shortcuts

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