Documentation
¶
Overview ¶
Package labeler provides a labeler subscription client for the hold service.
The hold subscribes to one labeler and mirrors active takedowns into a local cache (in-memory + SQLite). On takedown receipt the hold purges layer, scan, and image-config records for the affected manifest. The cache is consulted by the GC to gate blob deletion: while a takedown is within its grace window, the manifest's blob digests stay in the GC's referenced set so reversal can still restore them.
Index ¶
Constants ¶
const TakedownLabelValue = "!takedown"
TakedownLabelValue is the label value the hold treats as a takedown trigger. Mirrors what pkg/labeler/takedown.go emits.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Cache ¶
type Cache struct {
// contains filtered or unexported fields
}
Cache holds active takedown URIs and their creation timestamps. It is thread-safe and persists state to SQLite so the hold can answer takedown queries before the labeler subscription has caught up after a restart.
func NewCache ¶
NewCache opens (or creates) the takedown_cache and labeler_cursor tables on the given DB and loads any existing entries into memory.
func (*Cache) GetCursor ¶
GetCursor returns the last persisted cursor for a labeler DID (0 if none).
func (*Cache) IsTakenDown ¶
IsTakenDown reports whether a manifest URI is taken down, either directly (per-manifest takedown) or via a user-level takedown on its DID. The returned timestamp is the earliest cts that applies (i.e. the longest-standing takedown), which is what the grace check should compare against.
type PurgeOutcome ¶
PurgeOutcome mirrors pds.PurgeResult without creating an import cycle.
type Purger ¶
type Purger interface {
PurgeManifestRecords(ctx context.Context, manifestURI string) (PurgeOutcome, error)
PurgeUserManifests(ctx context.Context, userDID string) (PurgeOutcome, error)
}
Purger is the subset of HoldPDS the subscriber needs to act on takedowns. Defined as an interface so tests can substitute a stub without standing up a full PDS, and to avoid an import cycle with pkg/hold/pds.
type Subscriber ¶
type Subscriber struct {
// contains filtered or unexported fields
}
Subscriber connects to a labeler's subscribeLabels endpoint, mirrors takedowns into the local cache, and triggers record purges on the hold.
func NewSubscriber ¶
func NewSubscriber(labelerDID string, cache *Cache, purger Purger) *Subscriber
NewSubscriber builds a subscriber for the given labeler DID (did:plc or did:web). The websocket endpoint is resolved on each (re)connect through the shared identity directory's #atproto_labeler service entry, so the labeler can move (or fix a misconfigured endpoint) without clients redeploying.
func (*Subscriber) LabelerDID ¶
func (s *Subscriber) LabelerDID() string
LabelerDID returns the DID derived from the labeler URL. Useful for the caller to log the trusted source.
func (*Subscriber) Start ¶
func (s *Subscriber) Start()
Start runs the subscription loop in a goroutine.
func (*Subscriber) Stop ¶
func (s *Subscriber) Stop()
Stop signals the subscriber to shut down. Safe to call once.