sync_engine_shim_for_ndk 0.9.1
sync_engine_shim_for_ndk: ^0.9.1 copied to clipboard
Downward sync engine for the ndk package. Declare what you need, the engine keeps the NDK cache in sync with the relays.
0.9.1 #
- A set resolving to no relay, like an account without the list it reads, now
reports
syncedinstead offailed. No relay could answer, so the request stayed failed for good. It keeps ticking, closed windows included, and walks the relays once the list names some.
0.9.0 #
SyncRequest.relaysis aUrlSetfromurl_set_for_ndk, which this package re-exports. Wrap a fixed list inUrlSet.explicit. A set reading lists, likeUrlSet.dm(me)orUrlSet.outbox(pubkey), is resolved again on every pass, so a request follows the account when it changes its relays.- A list is read from the NDK cache for
SyncEngine.relayListMaxAge, an hour by default, and fetched again past that fromSyncEngine.discoveryRelaysand its owner's write relays. - A list never fetched, while no relay answers, fails the pass with
SyncRelaysUnavailable. The request keeps ticking until it comes through. SyncStorehas anurlListChecksstore, where the dates of those fetches live.SembastSyncStorekeeps them in the same database, andcleardrops them too.ensurerefuses a set reading Blossom servers.
0.8.1 #
- Accept
ndk0.11.0-dev.0 alongside 0.10. Nothing changed in the code.
0.8.0 #
SyncEngine.signerForsupplies the signer behind anauthPubkey, so a key no longer has to become an ndk account to sync. It defaults tondk.accounts.- A signer that signs as another pubkey reads nothing and reports
SyncAuthFailure.signerMismatch: coverage is filed under the pubkey named. SyncEnginetakes aSyncStoreinstead of a sembastDatabase, so coverage can live in any database.SembastSyncStore(db)reads what 0.7.2 wrote.- A relay named under two spellings is walked once, under its normalised url.
RelayKnowledgeis removed: the engine never read nor wrote it.
0.7.2 #
- Coverage validated by a clock since set back no longer passes for fresh. It stalled every revisit until the clock caught up with it.
0.7.1 #
- Depend on
ndk0.10.0-dev.6, which renamedRelayAuthtoAuthPolicy. 0.7.0 does not compile against it.
0.7.0 #
SyncEngine.coverageOfreads what is already synced for a request, andcoverageOfFilterreads it for one filter on every relay it was synced from. Both read the local state, and neither needs the request to be registered: knowing what the cache holds no longer means holding a handle and waiting for a pass to land.SyncEngine.forgetFilterforgets a filter on every relay it was synced from, rather than on the relays a request happens to name. Every held request carrying that filter walks it back from scratch.
0.6.0 #
- Coverage is only recorded when the relay sent an EOSE. An empty answer used to be the proof that a relay had nothing left, and a relay refusing a request returns no events either: the window was marked covered without a single event being read, and covered ground is never fetched again.
- A relay ending a request with a CLOSED is told apart from an unreachable one, and leaves its backoff untouched. It is up and answering, only not this request, so a retry would be refused again, and the backoff is per relay: counting a refusal would slow down the windows that relay does serve.
- Depend on
ndk0.10.0-dev.1, which reports what each relay did with a request. The timeout and connectivity heuristics that stood in for it are gone. SyncRequest.authPubkeyauthenticates (NIP-42). It is resolved againstndk.accountswhen the request runs rather than when it is registered, so a request declared before the login authenticates on its next pass, bound to that identity from the first page. Nothing watches for the login, so a pass that is worth having straight away is onerefreshaway.- A request naming nobody never sends an AUTH, whoever is logged in. Saying nothing was not neutral: a refused request authenticated as the logged account, and the anonymous state filled with data served under an identity.
- A request whose pubkey ndk does not have, or cannot sign with, reads nothing
and reports a
SyncAuthUnavailableonSyncRequestStatus.lastError. Reading anonymously would file the answers under an identity that never signed for them, and nothing afterwards could tell. The relay is left alone, backoff included: the configuration is what is wrong, not the relay.
0.5.0 #
SyncEngine.clearAllLocalDataforgets everything the engine persisted, for a full app reset. Local only, the NDK cache is the app's to clear. A cache emptied under a coverage that survived was never fetched again.SyncEngine.forgetdoes the same for one request, held or not. This is how an app scopes the cleanup to one account: authors are hashed into the fingerprint, so the engine cannot do it on its own.
0.4.0 #
- A held request now revisits its windows on its own, every
maxStaleness, for as long as the engine is started.ensuremeant keep this available but only ever filled what was missing at the moment it was called: staying up to date was left to an app writing a timer of its own.maxStalenessis now both the freshness asked for and the period paid for.stopstops the ticking,startpicks it up. SyncEnginetakes aminRevisitPeriod, 15 seconds by default. Under it a poll is a subscription written the wrong way round, and the engine cannot subscribe yet, so a shortermaxStalenessis honoured as this floor rather than spinning.- A window whose
untilis in the past no longer goes stale once it is covered to its end, and a request whose windows have all closed stops going back to the relays. An archive was refetching its trailing overlap on every pass, and would have been polled for good.refreshstill reopens it.
0.3.2 #
- Staleness is measured on the coverage nearest the end of the window being planned, rather than on the whole coverage of the filter, and only coverage that reached the end of the window it ran in has a say. Windows sharing a fingerprint share a coverage list, so a backfill bounded in 2024 marked everything after it as freshly validated and it was never fetched.
- A request is identified by its windows too, not only by its filters and
relays. Asking for the same filter over two periods gave the same handle
back, and the second set of filters was silently dropped. A filter whose
sincemoves between two calls now yields a handle of its own, where it used to join the previous one.
0.3.1 #
stopanddisposewait for a walk whose handle was released mid pass. Releasing dropped the registration, and with it the only way to reach the pass still running: it kept reading and writing the store after the caller closed the database.- A relay retry armed while
stopwas waiting is now cancelled too, instead of outliving the call.
0.3.0 #
- Depend on
ndk0.9.0.
0.2.0 #
SyncRequestStatuscarries aprogress, the last page that landed: relay, filter fingerprint, the period it closed and how many events it returned. The status is now emitted on every page rather than twice per pass.
0.1.1 #
- Never send a negative
sinceto a relay. A window opening at the epoch, or asincepushed under it by the overlap margin, used to produce a negative timestamp. A filter asks for everything by leavingsinceout.
0.1.0 #
- Initial version.