package admin

import "github.com/google/trillian/server/admin"

Package admin contains the TrillianAdminServer implementation.

Index

Types

type DeletedTreeGC

type DeletedTreeGC struct {
	// contains filtered or unexported fields
}

DeletedTreeGC garbage collects deleted trees.

Tree deletion goes through two separate stages: * Soft deletion, which "flips a bit" (see Tree.Deleted) but otherwise leaves the tree unaltered * Hard deletion, which effectively removes all tree data

DeletedTreeGC performs the transition from soft to hard deletion. Trees that have been deleted for at least DeletedThreshold are eligible for garbage collection.

func NewDeletedTreeGC

func NewDeletedTreeGC(admin storage.AdminStorage, threshold, minRunInterval time.Duration, mf monitoring.MetricFactory) *DeletedTreeGC

NewDeletedTreeGC returns a new DeletedTreeGC.

func (*DeletedTreeGC) Run

func (gc *DeletedTreeGC) Run(ctx context.Context)

Run starts the tree garbage collection process. It runs until ctx is cancelled.

func (*DeletedTreeGC) RunOnce

func (gc *DeletedTreeGC) RunOnce(ctx context.Context) (int, error)

RunOnce performs a single tree garbage collection sweep. Returns the number of successfully deleted trees.

It attempts to delete as many eligible trees as possible, regardless of failures. If it encounters any failures while deleting the resulting error is non-nil.

type Server

type Server struct {
	// contains filtered or unexported fields
}

Server is an implementation of trillian.TrillianAdminServer.

func New

func New(registry extension.Registry, allowedTreeTypes []trillian.TreeType) *Server

New returns a trillian.TrillianAdminServer implementation. registry is the extension.Registry used by the Server. allowedTreeTypes defines which tree types may be created through this server, with nil meaning unrestricted.

func (*Server) CreateTree

func (s *Server) CreateTree(ctx context.Context, req *trillian.CreateTreeRequest) (*trillian.Tree, error)

CreateTree implements trillian.TrillianAdminServer.CreateTree.

func (*Server) DeleteTree

func (s *Server) DeleteTree(ctx context.Context, req *trillian.DeleteTreeRequest) (*trillian.Tree, error)

DeleteTree implements trillian.TrillianAdminServer.DeleteTree.

func (*Server) GetTree

func (s *Server) GetTree(ctx context.Context, req *trillian.GetTreeRequest) (*trillian.Tree, error)

GetTree implements trillian.TrillianAdminServer.GetTree.

func (*Server) IsHealthy

func (s *Server) IsHealthy() error

IsHealthy returns nil if the server is healthy, error otherwise. TODO(Martin2112): This method (and the one in the log server) should probably have ctx as a param

func (*Server) ListTrees

ListTrees implements trillian.TrillianAdminServer.ListTrees.

func (*Server) UndeleteTree

func (s *Server) UndeleteTree(ctx context.Context, req *trillian.UndeleteTreeRequest) (*trillian.Tree, error)

UndeleteTree implements trillian.TrillianAdminServer.UndeleteTree.

func (*Server) UpdateTree

func (s *Server) UpdateTree(ctx context.Context, req *trillian.UpdateTreeRequest) (*trillian.Tree, error)

UpdateTree implements trillian.TrillianAdminServer.UpdateTree.

Source Files

admin_server.go doc.go tree_gc.go

Version
v1.7.1 (latest)
Published
Jan 9, 2025
Platform
linux/amd64
Imports
15 packages
Last checked
5 days ago

Tools for package owners.