diff --git a/lexicons/io/atcr/hold/setStats.json b/lexicons/io/atcr/hold/setStats.json deleted file mode 100644 index 782fbf4..0000000 --- a/lexicons/io/atcr/hold/setStats.json +++ /dev/null @@ -1,66 +0,0 @@ -{ - "lexicon": 1, - "id": "io.atcr.hold.setStats", - "defs": { - "main": { - "type": "procedure", - "description": "Set absolute stats values for a repository. Used for migration/admin purposes to set specific pull/push counts.", - "input": { - "encoding": "application/json", - "schema": { - "type": "object", - "required": ["ownerDid", "repository"], - "properties": { - "ownerDid": { - "type": "string", - "format": "did", - "description": "DID of the repository owner" - }, - "repository": { - "type": "string", - "maxLength": 256, - "description": "Repository name" - }, - "pullCount": { - "type": "integer", - "minimum": 0, - "description": "Absolute pull count to set" - }, - "pushCount": { - "type": "integer", - "minimum": 0, - "description": "Absolute push count to set" - }, - "lastPull": { - "type": "string", - "format": "datetime", - "description": "RFC3339 timestamp of last pull" - }, - "lastPush": { - "type": "string", - "format": "datetime", - "description": "RFC3339 timestamp of last push" - } - } - } - }, - "output": { - "encoding": "application/json", - "schema": { - "type": "object", - "required": ["success"], - "properties": { - "success": { - "type": "boolean", - "description": "Whether the stats were successfully updated" - } - } - } - }, - "errors": [ - { "name": "InvalidOwner" }, - { "name": "InvalidRepository" } - ] - } - } -} diff --git a/lexicons/io/atcr/hold/uploadPart.json b/lexicons/io/atcr/hold/uploadPart.json deleted file mode 100644 index f91aa5c..0000000 --- a/lexicons/io/atcr/hold/uploadPart.json +++ /dev/null @@ -1,33 +0,0 @@ -{ - "lexicon": 1, - "id": "io.atcr.hold.uploadPart", - "defs": { - "main": { - "type": "procedure", - "description": "Direct buffered part upload. Alternative to using presigned URLs from getPartUploadUrl. Requires X-Upload-Id and X-Part-Number headers.", - "input": { - "encoding": "*/*", - "description": "Raw binary part data" - }, - "output": { - "encoding": "application/json", - "schema": { - "type": "object", - "required": ["etag"], - "properties": { - "etag": { - "type": "string", - "maxLength": 256, - "description": "ETag of the uploaded part, required for completeUpload" - } - } - } - }, - "errors": [ - { "name": "InvalidUploadId" }, - { "name": "InvalidPartNumber" }, - { "name": "UploadFailed" } - ] - } - } -} diff --git a/lexicons/io/atcr/sailor/profile.json b/lexicons/io/atcr/sailor/profile.json index d13a09d..8b6db6b 100644 --- a/lexicons/io/atcr/sailor/profile.json +++ b/lexicons/io/atcr/sailor/profile.json @@ -12,8 +12,8 @@ "properties": { "defaultHold": { "type": "string", - "format": "uri", - "description": "Default hold endpoint for blob storage. If null, user has opted out of defaults." + "format": "did", + "description": "Default hold DID for blob storage. If null, user has opted out of defaults." }, "autoRemoveUntagged": { "type": "boolean", diff --git a/pkg/atproto/endpoints.go b/pkg/atproto/endpoints.go index 293cbe9..6580ceb 100644 --- a/pkg/atproto/endpoints.go +++ b/pkg/atproto/endpoints.go @@ -46,12 +46,6 @@ const ( // Response: {"success": true, "layersCreated": 5, "postCreated": true, "postUri": "at://..."} HoldNotifyManifest = "/xrpc/io.atcr.hold.notifyManifest" - // HoldSetStats sets absolute stats values for a repository (used by migration). - // Method: POST - // Request: {"ownerDid": "...", "repository": "...", "pullCount": 10, "pushCount": 5, "lastPull": "...", "lastPush": "..."} - // Response: {"success": true} - HoldSetStats = "/xrpc/io.atcr.hold.setStats" - // HoldGetQuota returns storage quota information for a user. // Method: GET // Query: userDid={did} diff --git a/pkg/hold/pds/stats.go b/pkg/hold/pds/stats.go index 0317928..294977d 100644 --- a/pkg/hold/pds/stats.go +++ b/pkg/hold/pds/stats.go @@ -93,49 +93,6 @@ func (p *HoldPDS) GetStats(ctx context.Context, ownerDID, repository string) (ci return recordCID, statsRecord, nil } -// SetStats directly sets the stats for a repository (used for migration) -// Creates or updates the stats record with the specified counts -func (p *HoldPDS) SetStats(ctx context.Context, ownerDID, repository string, pullCount, pushCount int64, lastPull, lastPush string) error { - rkey := atproto.StatsRecordKey(ownerDID, repository) - now := time.Now().Format(time.RFC3339) - - // Try to get existing record - _, existing, err := p.GetStats(ctx, ownerDID, repository) - if err != nil { - // Record doesn't exist - create new one - record := &atproto.StatsRecord{ - Type: atproto.StatsCollection, - OwnerDID: ownerDID, - Repository: repository, - PullCount: pullCount, - PushCount: pushCount, - LastPull: lastPull, - LastPush: lastPush, - UpdatedAt: now, - } - - _, _, err := p.repomgr.PutRecord(ctx, p.uid, atproto.StatsCollection, rkey, record) - if err != nil { - return fmt.Errorf("failed to create stats record: %w", err) - } - return nil - } - - // Record exists - update it - existing.PullCount = pullCount - existing.PushCount = pushCount - existing.LastPull = lastPull - existing.LastPush = lastPush - existing.UpdatedAt = now - - _, err = p.repomgr.UpdateRecord(ctx, p.uid, atproto.StatsCollection, rkey, existing) - if err != nil { - return fmt.Errorf("failed to update stats record: %w", err) - } - - return nil -} - // ListStats returns all stats records in the hold's PDS // This is used by AppView to aggregate stats from all holds func (p *HoldPDS) ListStats(ctx context.Context) ([]*atproto.StatsRecord, error) {