chitose.com.atproto.sync package#
Submodules#
chitose.com.atproto.sync.get_blob module#
chitose.com.atproto.sync.get_blocks module#
chitose.com.atproto.sync.get_checkout module#
chitose.com.atproto.sync.get_head module#
chitose.com.atproto.sync.get_latest_commit module#
chitose.com.atproto.sync.get_record module#
chitose.com.atproto.sync.get_repo module#
chitose.com.atproto.sync.get_repo_status module#
chitose.com.atproto.sync.list_blobs module#
chitose.com.atproto.sync.list_repos module#
- class chitose.com.atproto.sync.list_repos.Repo(did: str, head: str, rev: str, active: bool | None = None, status: Literal['takendown', 'suspended', 'deactivated'] | None = None)#
Bases:
Object- Parameters:
head – Current repo commit CID
status – If active=false, this optional field indicates a possible reason for why the account is not active. If active=false and no status is supplied, then the host makes no claim for why the repository is no longer being hosted.
- to_dict() dict[str, Any]#
chitose.com.atproto.sync.notify_of_update module#
chitose.com.atproto.sync.request_crawl module#
chitose.com.atproto.sync.subscribe_repos module#
- class chitose.com.atproto.sync.subscribe_repos.Account(seq: int, did: str, time: str, active: bool, status: Literal['takendown', 'suspended', 'deleted', 'deactivated'] | None = None)#
Bases:
ObjectRepresents a change to an account’s status on a host (eg, PDS or Relay). The semantics of this event are that the status is at the host which emitted the event, not necessarily that at the currently active PDS. Eg, a Relay takedown would emit a takedown with active=false, even if the PDS is still active.
- Parameters:
active – Indicates that the account has a repository which can be fetched from the host that emitted this event.
status – If active=false, this optional field indicates a reason for why the account is not active.
- to_dict() dict[str, Any]#
- class chitose.com.atproto.sync.subscribe_repos.Commit(seq: int, rebase: bool, too_big: bool, repo: str, commit: Any, rev: str, since: str, blocks: Any, ops: list[RepoOp], blobs: list[Any], time: str, prev: Any | None = None)#
Bases:
ObjectRepresents an update of repository state. Note that empty commits are allowed, which include no repo data changes, but an update to rev and signature.
- Parameters:
seq – The stream sequence number of this message.
rebase – DEPRECATED – unused
too_big – Indicates that this commit contained too many ops, or data size was too large. Consumers will need to make a separate request to get missing data.
repo – The repo this event comes from.
commit – Repo commit object CID.
rev – The rev of the emitted commit. Note that this information is also in the commit object included in blocks, unless this is a tooBig event.
since – The rev of the last emitted commit from this repo (if any).
blocks – CAR file containing relevant blocks, as a diff since the previous repo state.
time – Timestamp of when this message was originally broadcast.
prev – DEPRECATED – unused. WARNING – nullable and optional; stick with optional to ensure golang interoperability.
- to_dict() dict[str, Any]#
- class chitose.com.atproto.sync.subscribe_repos.Handle(seq: int, did: str, handle: str, time: str)#
Bases:
ObjectDEPRECATED – Use #identity event instead
- to_dict() dict[str, Any]#
- class chitose.com.atproto.sync.subscribe_repos.Identity(seq: int, did: str, time: str, handle: str | None = None)#
Bases:
ObjectRepresents a change to an account’s identity. Could be an updated handle, signing key, or pds hosting endpoint. Serves as a prod to all downstream services to refresh their identity cache.
- Parameters:
handle – The current handle for the account, or ‘handle.invalid’ if validation fails. This field is optional, might have been validated or passed-through from an upstream source. Semantics and behaviors for PDS vs Relay may evolve in the future; see atproto specs for more details.
- to_dict() dict[str, Any]#
- class chitose.com.atproto.sync.subscribe_repos.Info(name: Literal['OutdatedCursor'], message: str | None = None)#
Bases:
Object- to_dict() dict[str, Any]#
- class chitose.com.atproto.sync.subscribe_repos.Migrate(seq: int, did: str, migrate_to: str, time: str)#
Bases:
ObjectDEPRECATED – Use #account event instead
- to_dict() dict[str, Any]#
Module contents#
- class chitose.com.atproto.sync.Sync_(call: Callable[[str, list[tuple[str, str | None | int | list[str]]], bytes | dict[str, Any] | None, dict[str, str]], bytes], subscribe: Callable[[str, list[tuple[str, str | None | int | list[str]]], Callable[[str | bytes], None]], None])#
Bases:
objectWe recommend calling methods in this class via the chitose.BskyAgent class instead of creating instances of this class directly.
- get_blob(did: str, cid: str) bytes#
Get a blob associated with a given account. Returns the full blob as originally uploaded. Does not require auth; implemented by PDS.
- Parameters:
did – The DID of the account.
cid – The CID of the blob to fetch
- get_blocks(did: str, cids: list[str]) bytes#
Get data blocks from a given repo, by CID. For example, intermediate MST nodes, or records. Does not require auth; implemented by PDS.
- Parameters:
did – The DID of the repo.
- get_checkout(did: str) bytes#
DEPRECATED - please use com.atproto.sync.getRepo instead
- Parameters:
did – The DID of the repo.
- get_head(did: str) bytes#
DEPRECATED - please use com.atproto.sync.getLatestCommit instead
- Parameters:
did – The DID of the repo.
- get_latest_commit(did: str) bytes#
Get the current commit CID & revision of the specified repo. Does not require auth.
- Parameters:
did – The DID of the repo.
- get_record(did: str, collection: str, rkey: str, commit: str | None = None) bytes#
Get data blocks needed to prove the existence or non-existence of record in the current version of repo. Does not require auth.
- Parameters:
did – The DID of the repo.
rkey – Record Key
commit – DEPRECATED: referenced a repo commit by CID, and retrieved record as of that commit
- get_repo(did: str, since: str | None = None) bytes#
Download a repository export as CAR file. Optionally only a ‘diff’ since a previous revision. Does not require auth; implemented by PDS.
- Parameters:
did – The DID of the repo.
since – The revision (‘rev’) of the repo to create a diff from.
- get_repo_status(did: str) bytes#
Get the hosting status for a repository, on this server. Expected to be implemented by PDS and Relay.
- Parameters:
did – The DID of the repo.
- list_blobs(did: str, since: str | None = None, limit: int | None = None, cursor: str | None = None) bytes#
List blob CIDs for an account, since some repo revision. Does not require auth; implemented by PDS.
- Parameters:
did – The DID of the repo.
since – Optional revision of the repo to list blobs since.
- list_repos(limit: int | None = None, cursor: str | None = None) bytes#
Enumerates all the DID, rev, and commit CID for all repos hosted by this service. Does not require auth; implemented by PDS and Relay.
- notify_of_update(hostname: str) bytes#
Notify a crawling service of a recent update, and that crawling should resume. Intended use is after a gap between repo stream events caused the crawling service to disconnect. Does not require auth; implemented by Relay.
- Parameters:
hostname – Hostname of the current service (usually a PDS) that is notifying of update.
- request_crawl(hostname: str) bytes#
Request a service to persistently crawl hosted repos. Expected use is new PDS instances declaring their existence to Relays. Does not require auth.
- Parameters:
hostname – Hostname of the current service (eg, PDS) that is requesting to be crawled.
- subscribe_repos(handler: Callable[[str | bytes], None], cursor: int | None = None) None#
Repository event stream, aka Firehose endpoint. Outputs repo commits with diff data, and identity update events, for all repositories on the current server. See the atproto specifications for details around stream sequencing, repo versioning, CAR diff format, and more. Public and does not require auth; implemented by PDS and Relay.
- Parameters:
cursor – The last known event seq number to backfill from.