Something went wrong. Try again.
Monorepo for Tangled tangled.org
Something went wrong. Try again.
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131use knot_types::{ AccountDid, AtUri, ChangeId, CobId, ContributionPermission, Oid, RecordAddress, RecordCid, TypeName, UnixSeconds,};
#[derive(Debug, thiserror::Error)]pub enum PayloadError { #[error("dag-cbor encode failed: {0}")] Encode(String), #[error("dag-cbor decode failed: {0}")] Decode(String),}
#[derive(Debug, Clone, PartialEq, Eq)]pub struct AddressMove { pub object: CobId, pub expected: RecordAddress, pub found: RecordAddress,}
#[derive(Debug, thiserror::Error)]pub enum CobError { #[error(transparent)] Git(#[from] knot_git::GitError), #[error(transparent)] Payload(#[from] PayloadError), #[error("object {0} doesn't exist")] NoSuchObject(CobId), #[error("object {0} tip doesn't descend from its root change")] DetachedTip(CobId), #[error("object {object} tip doesn't descend from indexed tip {since}")] DivergedTip { object: CobId, since: ChangeId }, #[error( "folding change {change}, of object {object}, into that mr tip, which it doesn't descend from, would count changes the index already has" )] DeltaNotDescended { object: CobId, change: ChangeId }, #[error("change's {blob} blob, of {bytes} bytes, is over {limit} byte limit")] ChangeTooLarge { blob: &'static str, bytes: usize, limit: usize, }, #[error("object {0} isn't rooted at its genesis change")] RootNotGenesis(CobId), #[error("object {object} contains second parentless change {stray}")] MultipleRoots { object: CobId, stray: ChangeId }, #[error( "object {} materializes into {}, and change can't move it to {}", .0.object, .0.expected, .0.found )] AddressMoved(Box<AddressMove>), #[error("object {object} doesn't emit records. Change can't address one at {found}")] AddressAdded { object: CobId, found: RecordAddress }, #[error("object {object} with no record versions can't go stale")] Unaddressed { object: CobId }, #[error("{actor} may not write change authored by {author}, please sign it as its author")] Impersonation { actor: AccountDid, author: AccountDid, }, #[error("{actor} may not open {type_name} object here as {permission}")] CreateRejected { actor: AccountDid, type_name: TypeName, permission: ContributionPermission, }, #[error("{actor} may not append to object {object} as {permission}")] AppendRejected { actor: AccountDid, object: CobId, permission: ContributionPermission, }, #[error( "{uri} is at {current}, and change was made from another version, please rebase from {current}" )] StaleRecord { object: CobId, uri: AtUri<String>, current: RecordCid, }, #[error("Change declares record {declared} and stores {found}")] RecordMisclaimed { declared: RecordCid, found: RecordCid, }, #[error("change declares record {declared}. Change won't store said record's version")] RecordUnwritten { declared: RecordCid }, #[error("change erases its record, and stores said record's version instead of tombstone")] TombstoneUnwritten, #[error("Change that leaves its record live can't store its tombstone")] TombstoneUnclaimed, #[error("{type_name} change can't address the record at {found}, which is another collection")] AddressForeign { type_name: TypeName, found: RecordAddress, }, #[error("Change is stamped {stamped} and signed at {signed}")] StampMoved { stamped: UnixSeconds, signed: UnixSeconds, }, #[error("authoritative object {object} has forked history at merge change {change}")] ForkedHistory { object: CobId, change: ChangeId }, #[error("change {change} isn't validly signed by its owning identity")] UnverifiedChange { change: ChangeId }, #[error("concurrent write moved object {object} past expected tip {expected}")] StaleTip { object: CobId, expected: ChangeId }, #[error("object {0} exceeded its compare-and-swap retry budget under contention")] Contended(CobId), #[error("change {oid} is malformed: {reason}")] MalformedChange { oid: Oid, reason: String }, #[error("change {change} payload does not decode: {reason}")] UndecodableChange { change: ChangeId, reason: String }, #[error("change {change} is a {found} change in {expected} object")] UnexpectedChangeType { change: ChangeId, expected: TypeName, found: TypeName, }, #[error("produced unverifiable signature for {0} change")] SelfCheck(TypeName), #[error("change graph for {0} exceeds load bound")] HistoryTooLong(CobId), #[error("'{0}' is not usable collaborative-object ref name")] RefName(String), #[error("writing git object failed: {0}")] Write(String),}