42 lines
1.4 KiB
Go
42 lines
1.4 KiB
Go
package types
|
|
|
|
import "time"
|
|
|
|
// Metadata stored alongside the archive in S3
|
|
type Metadata struct {
|
|
UpdatedAt time.Time `json:"updated_at"` // last push timestamp
|
|
Files []string `json:"files"` // list of files in archive
|
|
Machine string `json:"machine"` // hostname of machine that pushed
|
|
SizeBytes int64 `json:"size_bytes"` // archive size in bytes
|
|
}
|
|
|
|
// ProjectInfo represents a project in storage (for listing)
|
|
type ProjectInfo struct {
|
|
Name string `json:"project"`
|
|
FileCount int `json:"files"`
|
|
UpdatedAt time.Time `json:"updated_at"`
|
|
SizeBytes int64 `json:"size_bytes"`
|
|
}
|
|
|
|
// FileStatus represents the sync status of a single file
|
|
type FileStatus struct {
|
|
Path string `json:"path"`
|
|
LocalSize int64 `json:"local_size"` // -1 if missing
|
|
RemoteSize int64 `json:"remote_size"` // -1 if missing
|
|
Status SyncStatus `json:"status"`
|
|
LocalHash string `json:"local_hash"` // MD5 or SHA256
|
|
RemoteHash string `json:"remote_hash"`
|
|
}
|
|
|
|
// SyncStatus represents the synchronization state
|
|
type SyncStatus string
|
|
|
|
const (
|
|
StatusUpToDate SyncStatus = "up_to_date"
|
|
StatusLocalModified SyncStatus = "local_modified"
|
|
StatusRemoteModified SyncStatus = "remote_modified"
|
|
StatusMissingLocal SyncStatus = "missing_local"
|
|
StatusLocalOnly SyncStatus = "local_only"
|
|
StatusConflict SyncStatus = "conflict" // both modified
|
|
)
|