Help us shape the future of Go! Take the 2026 Go Developer Survey

datasubject

package
v0.55.4 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 1, 2026 License: Apache-2.0, Apache-2.0 Imports: 7 Imported by: 0

Documentation

Overview

Package datasubject defines the shared wire contract for account export and erasure requests between the Cloud coordinator and every service that stores data about a subject.

Authority

Cloud owns the account, the subject reference and the lifecycle request and is the only coordinator. Each participant owns, exports and erases the data it holds. This package owns only the stable JSON shape, local validation and the completion rule; it performs no network I/O and persists nothing.

Subject reference

SubjectRef is an opaque identifier resolved by Cloud. A raw e-mail address is never a valid subject.

Receipts

A participant answers with a Receipt signed with its own Ed25519 key over the canonical JSON of the receipt without its signature. Backups and logs that age out later are reported as retained with a retained_until instant, never claimed as erased. The aggregate receipt carries no subject, tenant, user or job identifier.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CanCompleteErasure

func CanCompleteErasure(requestID string, participants []string, receipts []Receipt) error

CanCompleteErasure applies the coordinator rule: an erasure completes only when every registered participant returned erased or nothing_held for the request. The error names the first participant that does not qualify.

Types

type Dataset

type Dataset struct {
	ID     string `json:"id"`
	Action string `json:"action"`
	Rows   int64  `json:"rows"`
	Store  string `json:"store"`
}

Dataset reports what a participant did with one dataset.

type Kind

type Kind string

Kind is the lifecycle operation of a request.

const (
	KindExport Kind = "export"
	KindErase  Kind = "erase"
)

Request kinds.

type Processor

type Processor struct {
	Name      string `json:"name"`
	Action    string `json:"action"`
	Reference string `json:"reference"`
}

Processor reports the deletion mechanism of a downstream processor.

type Receipt

type Receipt struct {
	RequestID   string       `json:"request_id"`
	Service     string       `json:"service"`
	Kind        Kind         `json:"kind"`
	State       ReceiptState `json:"state"`
	CompletedAt time.Time    `json:"completed_at"`
	Datasets    []Dataset    `json:"datasets"`
	Retained    []Retained   `json:"retained"`
	Processors  []Processor  `json:"processors"`
	ReasonCode  *string      `json:"reason_code"`
	Signature   []byte       `json:"signature"`
}

Receipt is the signed terminal answer of one participant.

func (Receipt) Seal

func (r Receipt) Seal(key ed25519.PrivateKey) (Receipt, error)

Seal validates the receipt and signs it with the participant key.

func (Receipt) SigningBytes

func (r Receipt) SigningBytes() ([]byte, error)

SigningBytes is the canonical JSON of the receipt without its signature.

func (Receipt) Validate

func (r Receipt) Validate() error

Validate checks the receipt shape, not the signature.

func (Receipt) Verify

func (r Receipt) Verify(key ed25519.PublicKey) error

Verify checks the receipt shape and its signature against a participant key.

type ReceiptState

type ReceiptState string

ReceiptState is the terminal outcome a participant reports.

const (
	ReceiptErased      ReceiptState = "erased"
	ReceiptNothingHeld ReceiptState = "nothing_held"
	ReceiptExported    ReceiptState = "exported"
	ReceiptBlocked     ReceiptState = "blocked"
	ReceiptFailed      ReceiptState = "failed"
)

Receipt states. Only Erased and NothingHeld let an erasure complete; Exported is the terminal state of an export.

type Request

type Request struct {
	RequestID   string    `json:"request_id"`
	Kind        Kind      `json:"kind"`
	SubjectRef  string    `json:"subject_ref"`
	RequestedAt time.Time `json:"requested_at"`
	Deadline    time.Time `json:"deadline"`
}

Request is delivered to every participant; it is idempotent on RequestID.

func (Request) Validate

func (r Request) Validate() error

Validate checks the request locally.

type RequestState

type RequestState string

RequestState is the participant-reported progress of a request.

const (
	StateAccepted RequestState = "accepted"
	StateRunning  RequestState = "running"
	StateDone     RequestState = "done"
	StateBlocked  RequestState = "blocked"
	StateFailed   RequestState = "failed"
)

Request states.

type Retained

type Retained struct {
	ID            string    `json:"id"`
	Reason        string    `json:"reason"`
	RetainedUntil time.Time `json:"retained_until"`
}

Retained reports data that stays for a declared reason.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL