36 lines
1.4 KiB
Go
36 lines
1.4 KiB
Go
|
|
package backend
|
||
|
|
|
||
|
|
import (
|
||
|
|
"context"
|
||
|
|
"errors"
|
||
|
|
)
|
||
|
|
|
||
|
|
// Trillian is the production backend wrapper that will talk to a Trillian
|
||
|
|
// log server. It is intentionally a stub for now — ADR-0005 lists Trillian
|
||
|
|
// deployment + keys as a follow-up subtask. Once that lands, this struct
|
||
|
|
// gains a Trillian LogClient and translates Submit() into
|
||
|
|
// trillian.QueueLeaves + GetInclusionProofByHash (or the current API shape
|
||
|
|
// at the time of integration).
|
||
|
|
//
|
||
|
|
// Keeping the stub here lets the httpapi + wiring layer treat the two
|
||
|
|
// backends uniformly and prevents the server from accidentally shipping
|
||
|
|
// without a prod backend hook.
|
||
|
|
type Trillian struct {
|
||
|
|
// Endpoint will later hold the Trillian LogServer address, e.g.
|
||
|
|
// "trillian-log.agent-trust.svc.cluster.local:8090".
|
||
|
|
Endpoint string
|
||
|
|
// LogID will later hold the Trillian tree id this service writes to.
|
||
|
|
LogID int64
|
||
|
|
}
|
||
|
|
|
||
|
|
// Submit returns ErrTrillianUnavailable until the Trillian deployment ships.
|
||
|
|
// Config loading, auth plumbing and the actual LogClient wiring belong in
|
||
|
|
// the follow-up Trillian subtask.
|
||
|
|
func (t Trillian) Submit(_ context.Context, _ Envelope, _ string) (Receipt, bool, error) {
|
||
|
|
return Receipt{}, false, ErrTrillianUnavailable
|
||
|
|
}
|
||
|
|
|
||
|
|
// ErrTrillianUnavailable signals that the prod backend is not wired yet.
|
||
|
|
// Translated to HTTP 503 by the httpapi layer.
|
||
|
|
var ErrTrillianUnavailable = errors.New("transparency-log: trillian backend not deployed")
|