audit

package
v0.15.1 Latest Latest
Warning

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

Go to latest
Published: Nov 6, 2026 License: Apache-2.0 Imports: 14 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package audit keeps the audit log: every publish, done or refused, one per line of an append-only file, in the JSON form of the contract's AuditEntry. The file is rotated when it reaches a size; rotated files are deleted once older than an age.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Filter

type Filter struct {
	Since time.Time
	URL   string
	Limit int
}

Filter is which entries a read returns: from Since on (all when zero), of the repository at URL (any when empty), at most Limit of them.

type Log

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

Log is the audit log in a directory: the file being written, and those rotated out of it. RotateBytes is the size the file is rotated at; Keep is how long a rotated file is kept.

func New

func New(directory string, rotateBytes int64, keep time.Duration) (*Log, error)

New returns the audit log in directory, making it if it is not there, and deletes the rotated files older than keep.

func (*Log) Read

func (auditLog *Log) Read(filter Filter) ([]*gitdv1.AuditEntry, error)

Read returns the entries the filter keeps, newest first. A line that is not an entry, as a crash in the middle of a write may leave, is skipped.

func (*Log) Record

func (auditLog *Log) Record(entry *gitdv1.AuditEntry) error

Record appends an entry, stamped with the time now unless it has one, and syncs it to disk before it returns.

Jump to

Keyboard shortcuts

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