fix up lexicons and remvoe unused endpoints

This commit is contained in:
Evan Jarrett
2026-03-21 10:51:50 -05:00
parent cdca30f346
commit 8adbc7505f
5 changed files with 2 additions and 150 deletions
-66
View File
@@ -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" }
]
}
}
}
-33
View File
@@ -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" }
]
}
}
}
+2 -2
View File
@@ -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",
-6
View File
@@ -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}
-43
View File
@@ -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) {