Skip to main content

Module sync

Module sync 

Source
Expand description

Keeping the mirror current.

One pass asks GitHub about whatever is due, conditionally — an ETag makes an unchanged repository free, and since keeps a changed one small — writes what it learns into the mirror, and says what moved. Whoever runs passes — a daemon on a timer, wsb github sync from a shell — runs the same pass, so there is one schedule and one way of writing what came back.

§What a pass will not do

  • It never empties anything because a fetch failed. A failure is recorded beside the data, not instead of it.
  • It never forgets anything while some project could not be read: a worktree that failed to answer is not a worktree that has nothing.

Structs§

SyncReport
What a pass did.

Constants§

AFTER_FAILURE
How long a scope that FAILED waits before it is tried again. Longer than the sweep, because the common failures — no token, a rate limit, no network — do not resolve in two minutes.
SWEEP
How often a CONDITIONAL scope is re-asked about.
SWEEP_TRAFFIC
How often traffic is re-asked about. GitHub aggregates views and clones by day, so asking more than a few times a day cannot produce a different answer.
SWEEP_UNCONDITIONAL
How often a scope that CANNOT be conditional is re-asked about.
TICK
How often a long-running process runs a pass. Each pass asks only what is due, so this is how quickly something due is noticed, not how often GitHub is asked.

Functions§

board_scopes
The card scopes of every referenced board the mirror can resolve.
due
The schedule, as a decision about one state at one moment.
interval
How long a scope waits between askings, decided by whether the ask is FREE: a conditional request that answers 304 costs nothing, and anything that spends a request every time has to earn its frequency.
keep_current
Keep the machine’s mirror current for as long as the caller runs, and hand every pass’s report to on_pass.
owner_boards
One owner’s boards as the mirror holds them, or why it holds none.
resolve_boards
The boards the targets reference, as the mirror knows them.
sync
Sync everything that is due, and say what moved.
sync_scopes
Sync exactly these scopes, due or not as force says.
wanted
Every scope the targets want, except the boards’ cards.