mirror of
https://tangled.org/evan.jarrett.net/at-container-registry
synced 2026-09-19 00:34:16 +00:00
fix up lexicons and remvoe unused endpoints
This commit is contained in:
@@ -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" }
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -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" }
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -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",
|
||||
|
||||
@@ -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}
|
||||
|
||||
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user