sync app filled in

This commit is contained in:
2026-06-01 10:53:28 -04:00
parent ebe0920f89
commit fb0673a1c5
36 changed files with 4527 additions and 98 deletions

View File

@@ -46,6 +46,7 @@ type Change struct {
Path string `json:"path"`
OldPath string `json:"oldPath,omitempty"`
Hash string `json:"hash,omitempty"`
Content string `json:"content,omitempty"`
Size int64 `json:"size,omitempty"`
Modified time.Time `json:"modified,omitempty"`
}
@@ -67,8 +68,9 @@ type Conflict struct {
// DeltaResult is the server's response to a delta upload.
type DeltaResult struct {
ServerDelta []Change `json:"serverDelta"`
Conflicts []Conflict `json:"conflicts"`
ServerDelta []Change `json:"serverDelta"`
Conflicts []Conflict `json:"conflicts"`
NewSnapshotID string `json:"newSnapshotId,omitempty"`
}
// Resolution is a user's choice for resolving a conflict.
@@ -76,6 +78,8 @@ type Resolution struct {
Path string `json:"path"`
Strategy ResolutionStrategy `json:"strategy"`
NewPath string `json:"newPath,omitempty"` // for rename-both
Hash string `json:"hash,omitempty"`
Content string `json:"content,omitempty"`
}
// InitRequest starts a new sync session.
@@ -86,26 +90,27 @@ type InitRequest struct {
// InitResponse returns the server's current snapshot.
type InitResponse struct {
SnapshotID string `json:"snapshotId"`
ServerSnapshot []FileEntry `json:"serverSnapshot"`
SnapshotID string `json:"snapshotId"`
ServerSnapshot []FileEntry `json:"serverSnapshot"`
}
// DeltaRequest uploads client changes.
type DeltaRequest struct {
SnapshotID string `json:"snapshotId"`
SnapshotID string `json:"snapshotId"`
ClientDelta []Change `json:"clientDelta"`
}
// DeltaResponse returns server changes and conflicts.
type DeltaResponse struct {
ServerDelta []Change `json:"serverDelta"`
Conflicts []Conflict `json:"conflicts"`
ServerDelta []Change `json:"serverDelta"`
Conflicts []Conflict `json:"conflicts"`
NewSnapshotID string `json:"newSnapshotId,omitempty"`
}
// ResolveRequest uploads conflict resolutions.
type ResolveRequest struct {
SnapshotID string `json:"snapshotId"`
Resolutions []Resolution `json:"resolutions"`
SnapshotID string `json:"snapshotId"`
Resolutions []Resolution `json:"resolutions"`
}
// ResolveResponse confirms the new snapshot.