sync_engine_shim_for_ndk 0.9.1 copy "sync_engine_shim_for_ndk: ^0.9.1" to clipboard
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 synced instead of failed. 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.relays is a UrlSet from url_set_for_ndk, which this package re-exports. Wrap a fixed list in UrlSet.explicit. A set reading lists, like UrlSet.dm(me) or UrlSet.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 from SyncEngine.discoveryRelays and 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.
  • SyncStore has an urlListChecks store, where the dates of those fetches live. SembastSyncStore keeps them in the same database, and clear drops them too.
  • ensure refuses a set reading Blossom servers.

0.8.1 #

  • Accept ndk 0.11.0-dev.0 alongside 0.10. Nothing changed in the code.

0.8.0 #

  • SyncEngine.signerFor supplies the signer behind an authPubkey, so a key no longer has to become an ndk account to sync. It defaults to ndk.accounts.
  • A signer that signs as another pubkey reads nothing and reports SyncAuthFailure.signerMismatch: coverage is filed under the pubkey named.
  • SyncEngine takes a SyncStore instead of a sembast Database, 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.
  • RelayKnowledge is 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 ndk 0.10.0-dev.6, which renamed RelayAuth to AuthPolicy. 0.7.0 does not compile against it.

0.7.0 #

  • SyncEngine.coverageOf reads what is already synced for a request, and coverageOfFilter reads 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.forgetFilter forgets 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 ndk 0.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.authPubkey authenticates (NIP-42). It is resolved against ndk.accounts when 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 one refresh away.
  • 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 SyncAuthUnavailable on SyncRequestStatus.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.clearAllLocalData forgets 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.forget does 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. ensure meant 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. maxStaleness is now both the freshness asked for and the period paid for. stop stops the ticking, start picks it up.
  • SyncEngine takes a minRevisitPeriod, 15 seconds by default. Under it a poll is a subscription written the wrong way round, and the engine cannot subscribe yet, so a shorter maxStaleness is honoured as this floor rather than spinning.
  • A window whose until is 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. refresh still 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 since moves between two calls now yields a handle of its own, where it used to join the previous one.

0.3.1 #

  • stop and dispose wait 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 stop was waiting is now cancelled too, instead of outliving the call.

0.3.0 #

  • Depend on ndk 0.9.0.

0.2.0 #

  • SyncRequestStatus carries a progress, 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 since to a relay. A window opening at the epoch, or a since pushed under it by the overlap margin, used to produce a negative timestamp. A filter asks for everything by leaving since out.

0.1.0 #

  • Initial version.
1
likes
160
points
875
downloads

Documentation

API reference

Publisher

unverified uploader

Weekly Downloads

Downward sync engine for the ndk package. Declare what you need, the engine keeps the NDK cache in sync with the relays.

Repository (GitHub)
View/report issues

Topics

#nostr #ndk #sync

License

MIT (license)

Dependencies

crypto, ndk, rxdart, sembast, url_set_for_ndk

More

Packages that depend on sync_engine_shim_for_ndk