Documentation
¶
Index ¶
- Variables
- func SpaceModels() []any
- type Actor
- type Blob
- type BlobDeletion
- type BlobPart
- type Block
- type EventRecord
- type InviteCode
- type Record
- type RefreshToken
- type Repo
- type RepoActor
- type ReservedKey
- type SimpleSpace
- type SimpleSpaceMember
- type SpaceBlobRef
- type SpaceNotifyDelivery
- type SpaceNotifyRegistration
- type SpaceRecord
- type SpaceReplay
- type SpaceReplayJTI
- type SpaceRepo
- type SpaceRepoOp
- type SpaceTombstone
- type SpaceWriter
- type Token
- type TwoFactorType
Constants ¶
This section is empty.
Variables ¶
var ( TwoFactorTypeNone = TwoFactorType("none") TwoFactorTypeEmail = TwoFactorType("email") )
Functions ¶
func SpaceModels ¶ added in v0.11.1
func SpaceModels() []any
SpaceModels returns every Spaces persistence model. Keep this list as the single source of truth for production and test AutoMigrate calls.
Types ¶
type Blob ¶
type Blob struct {
ID uint
CreatedAt string `gorm:"index"`
Did string `gorm:"index;index:idx_blob_did_cid"`
Cid []byte `gorm:"index;index:idx_blob_did_cid"`
MimeType string
Size int64
RefCount int
Storage string `gorm:"default:sqlite"`
// Bucket and ObjectKey are immutable S3 identity for this blob generation.
// Empty ObjectKey is retained for legacy rows, which resolve to the original
// blobs/{did}/{cid} location at read/deletion time.
Bucket string
ObjectKey string
}
type BlobDeletion ¶ added in v0.11.1
type BlobDeletion struct {
ID uint `gorm:"primaryKey"`
IdempotencyKey string `gorm:"uniqueIndex"`
Bucket string
ObjectKey string
Status string `gorm:"index:idx_blob_deletions_status"`
AttemptCount int
NextAttemptAt *time.Time `gorm:"index"`
LastError string
DeletedAt *time.Time
CreatedAt time.Time
UpdatedAt time.Time
}
BlobDeletion is durable work for removing an S3-backed blob after its account metadata has been deleted. ObjectKey and Bucket are snapshotted at enqueue time so retries do not depend on mutable server configuration.
type EventRecord ¶ added in v0.8.4
type InviteCode ¶
type RefreshToken ¶
type Repo ¶
type Repo struct {
Did string `gorm:"primaryKey"`
CreatedAt time.Time
Email string `gorm:"uniqueIndex"`
EmailConfirmedAt *time.Time
EmailVerificationCode *string
EmailVerificationCodeExpiresAt *time.Time
EmailUpdateCode *string
EmailUpdateCodeExpiresAt *time.Time
PasswordResetCode *string
PasswordResetCodeExpiresAt *time.Time
PlcOperationCode *string
PlcOperationCodeExpiresAt *time.Time
AccountDeleteCode *string
AccountDeleteCodeExpiresAt *time.Time
Password string
SigningKey []byte
Rev string
Root []byte
Preferences []byte
Deactivated bool
Suspended bool
Takendown bool
TwoFactorCode *string
TwoFactorCodeExpiresAt *time.Time
TwoFactorType TwoFactorType `gorm:"default:none"`
}
type ReservedKey ¶ added in v0.7.0
type SimpleSpace ¶ added in v0.11.1
type SimpleSpace struct {
URI string `gorm:"primaryKey"`
OwnerDID string `gorm:"column:owner_did;index:idx_simple_spaces_owner"`
Type string
SKey string
Policy string
ManagingApp *string
AppAccess string
AllowedClientIDs []byte
Deleted bool `gorm:"index:idx_simple_spaces_deleted"`
DeletedAt *time.Time `gorm:"index"`
CreatedAt time.Time
UpdatedAt time.Time
}
SimpleSpace stores host-local configuration for a managed space. Policy and AppAccess contain the discriminant (for example, "public" or "allowList"); ManagingApp and AllowedClientIDs hold the data for the variants that need it. AllowedClientIDs is canonical JSON so it remains portable across SQLite and Postgres without introducing a database-specific array type.
type SimpleSpaceMember ¶ added in v0.11.1
type SimpleSpaceMember struct {
Space string `gorm:"primaryKey;index:idx_simple_space_members_space"`
DID string `gorm:"column:did;primaryKey;index:idx_simple_space_members_did"`
CreatedAt time.Time
UpdatedAt time.Time
RemovedAt *time.Time `gorm:"index"`
}
SimpleSpaceMember is host-local membership state used by the member-list SimpleSpace policy. A member may belong to many spaces.
type SpaceBlobRef ¶ added in v0.11.1
type SpaceBlobRef struct {
Space string `gorm:"primaryKey;index:idx_space_blob_refs_record;index:idx_space_blob_refs_space_author_cid"`
Author string `gorm:"primaryKey;index:idx_space_blob_refs_record;index:idx_space_blob_refs_space_author_cid"`
Collection string `gorm:"primaryKey;index:idx_space_blob_refs_record"`
Rkey string `gorm:"primaryKey;index:idx_space_blob_refs_record"`
CID string `gorm:"column:cid;primaryKey;index:idx_space_blob_refs_cid;index:idx_space_blob_refs_space_author_cid"`
CreatedAt time.Time
UpdatedAt time.Time
}
SpaceBlobRef links a blob CID to a record identity in a space. Keeping the full record identity in the key makes listBlobs authorization-scoped and lets callers enumerate all references without a global blob visibility leak.
type SpaceNotifyDelivery ¶ added in v0.11.1
type SpaceNotifyDelivery struct {
ID uint `gorm:"primaryKey"`
IdempotencyKey string `gorm:"uniqueIndex"`
Kind string `gorm:"index:idx_space_notify_deliveries_kind"`
Space string `gorm:"index:idx_space_notify_deliveries_space"`
Service string `gorm:"index:idx_space_notify_deliveries_service"`
Author string
Rev string
Hash []byte
Deleted bool
Payload []byte
Status string `gorm:"index:idx_space_notify_deliveries_status"`
AttemptCount int
NextAttemptAt *time.Time `gorm:"index"`
ExpiresAt time.Time `gorm:"index"`
DeliveredAt *time.Time
LastError string
CreatedAt time.Time
UpdatedAt time.Time
}
SpaceNotifyDelivery is a durable best-effort notification outbox entry. Payload may contain the canonical request body; the individual fields make retry, inspection, and de-duplication possible without decoding it.
type SpaceNotifyRegistration ¶ added in v0.11.1
type SpaceNotifyRegistration struct {
Space string `gorm:"primaryKey;index:idx_space_notify_registrations_space"`
Service string `gorm:"primaryKey;index:idx_space_notify_registrations_space"`
ExpiresAt time.Time `gorm:"index"`
CreatedAt time.Time
UpdatedAt time.Time
}
SpaceNotifyRegistration is a service's write-notification subscription for a space. Re-registering the same service updates this row and its expiry.
type SpaceRecord ¶ added in v0.11.1
type SpaceRecord struct {
Space string `gorm:"primaryKey;index:idx_space_records_space_author"`
Author string `gorm:"primaryKey;index:idx_space_records_space_author"`
Collection string `gorm:"primaryKey;index:idx_space_records_record"`
Rkey string `gorm:"primaryKey;index:idx_space_records_record"`
CID string `gorm:"column:cid"`
CanonicalCBOR []byte
CreatedAt time.Time
UpdatedAt time.Time
}
SpaceRecord is the current value of a record in a permissioned repo. CanonicalCBOR is stored verbatim as the record's canonical DAG-CBOR bytes.
type SpaceReplay ¶ added in v0.11.1
type SpaceReplay = SpaceReplayJTI
SpaceReplay is retained as a concise compatibility alias for callers that refer to the record by its purpose rather than its storage key.
type SpaceReplayJTI ¶ added in v0.11.1
type SpaceReplayJTI struct {
JTI string `gorm:"primaryKey"`
TokenType string `gorm:"index:idx_space_replay_jtis_type"`
ExpiresAt time.Time `gorm:"index"`
CreatedAt time.Time
}
SpaceReplayJTI is a durable single-use-token/DPoP replay record. JTI is globally unique because a token replay must be rejected regardless of which space or endpoint first consumed it.
type SpaceRepo ¶ added in v0.11.1
type SpaceRepo struct {
Space string `gorm:"primaryKey;index:idx_space_repos_space_author"`
Author string `gorm:"primaryKey;index:idx_space_repos_space_author"`
Rev string `gorm:"index:idx_space_repos_rev,sort:desc"`
LtHash []byte `gorm:"not null"`
Status string `gorm:"index:idx_space_repos_status"`
Deleted bool `gorm:"index:idx_space_repos_deleted"`
DeletedAt *time.Time `gorm:"index"`
CreatedAt time.Time
UpdatedAt time.Time
}
SpaceRepo is the latest observed state of one author's repo in a space. Space and Author are the repo identity; Rev and LtHash describe its latest observed commit. LtHash contains the serialized 2,048-byte LtHash state, not the SHA-256 digest exposed by the wire API.
type SpaceRepoOp ¶ added in v0.11.1
type SpaceRepoOp struct {
Space string `gorm:"primaryKey;index:idx_space_repo_ops_repo"`
Author string `gorm:"primaryKey;index:idx_space_repo_ops_repo"`
Rev string `gorm:"primaryKey;index:idx_space_repo_ops_repo,sort:asc"`
Idx int `gorm:"primaryKey;index:idx_space_repo_ops_repo,sort:asc"`
Collection string
Rkey string
CurrentCID *string `gorm:"column:current_cid"`
PreviousCID *string `gorm:"column:previous_cid"`
CreatedAt time.Time
}
SpaceRepoOp is one retained operation in a repo's append-only operation log. A nil CurrentCID means delete and a nil PreviousCID means create.
type SpaceTombstone ¶ added in v0.11.1
type SpaceTombstone struct {
Space string `gorm:"primaryKey"`
OwnerDID string `gorm:"column:owner_did"`
SourceDID string `gorm:"column:source_did"`
SourceNotification string
DeletedAt time.Time `gorm:"index"`
CreatedAt time.Time
}
SpaceTombstone records deletion of a space. The space URI is the primary key so deletion notification and replay handling are idempotent.
type SpaceWriter ¶ added in v0.11.1
type SpaceWriter struct {
Space string `gorm:"primaryKey;index:idx_space_writers_space"`
Author string `gorm:"primaryKey;index:idx_space_writers_space"`
Host string
Rev string
Hash []byte
LastNotifiedAt *time.Time `gorm:"index"`
Status string `gorm:"index:idx_space_writers_status"`
DeletedAt *time.Time `gorm:"index"`
CreatedAt time.Time
UpdatedAt time.Time
}
SpaceWriter is the writer set for a space. It is deliberately separate from SpaceRepo so a host can retain writer registration/endpoint state even while a repo snapshot is being replaced or marked deleted.
type TwoFactorType ¶ added in v0.8.0
type TwoFactorType string