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.
§Which boards
Every board of every owner this person reaches: the token’s own account, each organisation it is a member of, and the owner of every board a project references. Board LISTS are cheap — one request per owner — so all of them are kept current. CARDS cost a request per board, so they are kept current for the boards a project references and for any other board once somebody has opened it, the rule comment threads already follow.
Structs§
- Sync
Report - 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_
owners - Every owner whose boards are mirrored: the token’s account, its organisations, and the owner of every board a project references.
- board_
scopes - The card scopes to keep current: every referenced board the mirror can resolve, and every other board whose cards are held and that its owner still lists.
- 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_
boards - Bring the boards current, and nothing else: who the token is, every owner’s board list, then the cards of the referenced boards and of every board whose cards are held.
- sync_
scopes - Sync exactly these scopes, due or not as
forcesays. - viewer
- Who the token belongs to and its organisations, as the mirror holds them.
- wanted
- Every scope the targets want, except who the token is and the boards’ cards.