Documentation
¶
Index ¶
- Variables
- type BatchCleanups
- type BatchConflict
- type BatchIgnored
- type BatchLocalDelete
- type BatchLocalWrite
- type BatchRemoteDelete
- type BatchRemoteWrite
- type BatchUnchanged
- type FileContent
- type FileMetadata
- type FileWatcher
- type OpType
- type PathStatus
- type ReconcileOperations
- type SyncEngine
- type SyncIgnoreList
- type SyncJournal
- func (s *SyncJournal) Close() error
- func (s *SyncJournal) ContentsChanged(path string, etag string) (bool, error)
- func (s *SyncJournal) Count() (int, error)
- func (s *SyncJournal) Delete(path string) error
- func (s *SyncJournal) Destroy() error
- func (s *SyncJournal) Get(path string) (*FileMetadata, error)
- func (s *SyncJournal) GetPaths() ([]string, error)
- func (s *SyncJournal) GetState() (map[string]*FileMetadata, error)
- func (s *SyncJournal) Open() error
- func (s *SyncJournal) Set(state *FileMetadata) error
- type SyncLocalState
- type SyncManager
- type SyncOperation
- type SyncPriorityList
- type SyncStatus
- func (s *SyncStatus) Count() int
- func (s *SyncStatus) IsSyncing(path string) bool
- func (s *SyncStatus) SetCompleted(path string, src string)
- func (s *SyncStatus) SetError(path string, src string)
- func (s *SyncStatus) SetProgress(path string, progress float64)
- func (s *SyncStatus) SetSyncing(path string, src string)
- type SyncStatusEvent
Constants ¶
This section is empty.
Variables ¶
var (
ErrSyncAlreadyRunning = errors.New("sync already running")
)
Functions ¶
This section is empty.
Types ¶
type BatchCleanups ¶
type BatchCleanups = map[string]struct{}
BatchCleanups represents a set of paths that require local cleanup (e.g., removing tombstones).
type BatchConflict ¶
type BatchConflict = map[string]*SyncOperation
BatchConflict represents a collection of sync operations where conflicts were detected.
type BatchIgnored ¶
type BatchIgnored = map[string]struct{}
BatchIgnored represents a set of paths that were ignored.
type BatchLocalDelete ¶
type BatchLocalDelete = map[string]*SyncOperation
BatchLocalDelete represents a collection of sync operations for items deleted locally.
type BatchLocalWrite ¶
type BatchLocalWrite = map[string]*SyncOperation
BatchLocalWrite represents a collection of sync operations for items created or updated locally.
type BatchRemoteDelete ¶
type BatchRemoteDelete = map[string]*SyncOperation
BatchRemoteDelete represents a collection of sync operations for items deleted remotely.
type BatchRemoteWrite ¶
type BatchRemoteWrite = map[string]*SyncOperation
BatchRemoteWrite represents a collection of sync operations for items created or updated remotely.
type BatchUnchanged ¶
type BatchUnchanged = map[string]struct{}
BatchUnchanged represents a set of paths that were compared and found to be unchanged.
type FileContent ¶
type FileContent struct {
FileMetadata
Content []byte
}
func NewFileContent ¶
func NewFileContent(path string) (*FileContent, error)
type FileMetadata ¶
type FileWatcher ¶
type FileWatcher struct {
// contains filtered or unexported fields
}
func NewFileWatcher ¶
func NewFileWatcher(watchDir string) *FileWatcher
func (*FileWatcher) Events ¶
func (fw *FileWatcher) Events() <-chan notify.EventInfo
func (*FileWatcher) Stop ¶
func (fw *FileWatcher) Stop()
type PathStatus ¶
type PathStatus struct{}
type ReconcileOperations ¶
type ReconcileOperations struct {
LocalWrites BatchLocalWrite
RemoteWrites BatchRemoteWrite
LocalDeletes BatchLocalDelete
RemoteDeletes BatchRemoteDelete
Conflicts BatchConflict
UnchangedPaths BatchUnchanged
Cleanups BatchCleanups
Ignored BatchIgnored
Total int
}
ReconcileOperations aggregates the results of a sync reconciliation process, categorizing operations based on their type and origin.
func NewReconcileOperations ¶
func NewReconcileOperations() *ReconcileOperations
NewReconcileOperations initializes and returns an empty ReconcileOperations struct.
func (*ReconcileOperations) HasChanges ¶
func (r *ReconcileOperations) HasChanges() bool
HasChanges returns true if there are any pending write, delete, conflict, or cleanup operations resulting from the reconciliation.
type SyncEngine ¶
type SyncEngine struct {
// contains filtered or unexported fields
}
func NewSyncEngine ¶
func NewSyncEngine( workspace *workspace.Workspace, sdk *syftsdk.SyftSDK, ignore *SyncIgnoreList, priority *SyncPriorityList, watcher *FileWatcher, ) (*SyncEngine, error)
func (*SyncEngine) RunSync ¶
func (se *SyncEngine) RunSync(ctx context.Context) error
RunSync performs a full sync of the local and remote states
func (*SyncEngine) Stop ¶
func (se *SyncEngine) Stop() error
type SyncIgnoreList ¶
type SyncIgnoreList struct {
// contains filtered or unexported fields
}
func NewSyncIgnoreList ¶
func NewSyncIgnoreList(baseDir string) *SyncIgnoreList
func (*SyncIgnoreList) Load ¶
func (s *SyncIgnoreList) Load()
func (*SyncIgnoreList) ShouldIgnore ¶
func (s *SyncIgnoreList) ShouldIgnore(path string) bool
type SyncJournal ¶
type SyncJournal struct {
// contains filtered or unexported fields
}
SyncJournal manages the persistent state of synced files using SQLite.
func NewSyncJournal ¶
func NewSyncJournal(dbPath string) (*SyncJournal, error)
NewSyncJournal creates or opens a SyncJournal backed by an SQLite database.
func (*SyncJournal) Close ¶
func (s *SyncJournal) Close() error
Close closes the underlying database connection.
func (*SyncJournal) ContentsChanged ¶
func (s *SyncJournal) ContentsChanged(path string, etag string) (bool, error)
func (*SyncJournal) Count ¶
func (s *SyncJournal) Count() (int, error)
Count returns the number of entries in the journal.
func (*SyncJournal) Delete ¶
func (s *SyncJournal) Delete(path string) error
Delete removes an entry from the journal by its key (path).
func (*SyncJournal) Destroy ¶
func (s *SyncJournal) Destroy() error
func (*SyncJournal) Get ¶
func (s *SyncJournal) Get(path string) (*FileMetadata, error)
Get retrieves the metadata for a specific path.
func (*SyncJournal) GetPaths ¶
func (s *SyncJournal) GetPaths() ([]string, error)
GetPaths retrieves all paths known to the journal.
func (*SyncJournal) GetState ¶
func (s *SyncJournal) GetState() (map[string]*FileMetadata, error)
GetState retrieves the entire state map from the journal.
func (*SyncJournal) Open ¶
func (s *SyncJournal) Open() error
Open the sync journal and the underlying database
func (*SyncJournal) Set ¶
func (s *SyncJournal) Set(state *FileMetadata) error
Set inserts or updates the metadata for a specific path using named parameters.
type SyncLocalState ¶
type SyncLocalState struct {
// contains filtered or unexported fields
}
func NewSyncLocalState ¶
func NewSyncLocalState(rootDir string) *SyncLocalState
func (*SyncLocalState) Scan ¶
func (s *SyncLocalState) Scan() (map[string]*FileMetadata, error)
type SyncManager ¶
type SyncManager struct {
// contains filtered or unexported fields
}
func NewManager ¶
func (*SyncManager) Stop ¶
func (m *SyncManager) Stop() error
type SyncOperation ¶
type SyncOperation struct {
Op OpType
RelPath string // Datasite relative path
Local *FileMetadata
Remote *FileMetadata
LastSynced *FileMetadata
}
type SyncPriorityList ¶
type SyncPriorityList struct {
// contains filtered or unexported fields
}
func NewSyncPriorityList ¶
func NewSyncPriorityList(baseDir string) *SyncPriorityList
func (*SyncPriorityList) ShouldPrioritize ¶
func (s *SyncPriorityList) ShouldPrioritize(path string) bool
type SyncStatus ¶
type SyncStatus struct {
// contains filtered or unexported fields
}
func NewSyncStatus ¶
func NewSyncStatus() *SyncStatus
func (*SyncStatus) Count ¶
func (s *SyncStatus) Count() int
func (*SyncStatus) IsSyncing ¶
func (s *SyncStatus) IsSyncing(path string) bool
func (*SyncStatus) SetCompleted ¶
func (s *SyncStatus) SetCompleted(path string, src string)
func (*SyncStatus) SetError ¶
func (s *SyncStatus) SetError(path string, src string)
func (*SyncStatus) SetProgress ¶
func (s *SyncStatus) SetProgress(path string, progress float64)
func (*SyncStatus) SetSyncing ¶
func (s *SyncStatus) SetSyncing(path string, src string)
type SyncStatusEvent ¶
type SyncStatusEvent struct{}
Source Files
¶
- file_content.go
- file_metadata.go
- file_watcher.go
- sync_engine.go
- sync_engine_conflict.go
- sync_engine_delete.go
- sync_engine_download.go
- sync_engine_priority_download.go
- sync_engine_priority_error.go
- sync_engine_priority_upload.go
- sync_engine_types.go
- sync_engine_upload.go
- sync_ignore.go
- sync_journal.go
- sync_local_state.go
- sync_manager.go
- sync_op.go
- sync_priority.go
- sync_status.go
- sync_utils.go