synctracker

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Oct 11, 2026 License: AGPL-3.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ListWrites added in v0.5.0

func ListWrites() uint64

ListWrites returns that count.

Types

type File

type File struct {
	Name string

	RelativePath   string // Path relative to the root of the mounted filesystem.
	RealPathOfFile string // Path on the local filesystem.

	LastEditTime uint64 // Use time.Now().UnixNano().
	CreatedTime  uint64
	Atime        uint64 // Announced access time, unix nanoseconds. 0 means unknown.

	Size uint64
	Mode uint32 // Announced mode bits. 0 means unknown; presenters fall back to 0644.
}

type RWMutex added in v0.5.0

type RWMutex struct {
	sync.RWMutex
}

RWMutex is a sync.RWMutex whose write unlock bumps listWrites. The count adds no waiting: Unlock bumps it and returns.

func (*RWMutex) Unlock added in v0.5.0

func (m *RWMutex) Unlock()

Unlock counts the write first, so a reader that sees the new count and then takes the lock reads the new map.

type SyncTracker

type SyncTracker struct {
	LocalFilesMu RWMutex
	LocalFiles   map[string]*File

	RemoteFilesMu RWMutex
	RemoteFiles   map[string]*File
}

func NewSyncTracker

func NewSyncTracker() *SyncTracker

func (*SyncTracker) PruneStaleLocalFiles added in v0.3.0

func (st *SyncTracker) PruneStaleLocalFiles()

PruneStaleLocalFiles removes entries whose underlying file no longer exists. The disk checks run outside the lock: one stat per shared file under the write lock stalled every reader of the list. The write lock is taken only when something is gone, and an entry replaced meanwhile stays.

Jump to

Keyboard shortcuts

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