Documentation
¶
Index ¶
- Constants
- Variables
- type Connection
- type FailedConnection
- type Writer
- func (r *Writer) CloseConnection(connectionName string) error
- func (r *Writer) CreateConnection(_ context.Context, connectionName string, config interface{}) error
- func (r *Writer) Publish(_ context.Context, connectionName string, data interface{}, topic string) error
- func (r *Writer) UpdateConnection(_ context.Context, connectionName string, config interface{}) error
Constants ¶
View Source
const (
Name = "disk"
)
Variables ¶
View Source
var Connections = &Writer{ openConnections: make(map[string]Connection), closedConnections: make(map[string]FailedConnection), cleanupDone: make(chan struct{}), closeAndRemoveFilesWithRetry: func(conn Connection) error { return wait.ExponentialBackoff(retry.DefaultBackoff, func() (bool, error) { if conn.File != nil { if err := conn.unlockAndCloseFile(); err != nil { return false, fmt.Errorf("error closing file: %w", err) } } if err := os.RemoveAll(conn.Path); err != nil { return false, fmt.Errorf("error deleting violations stored at old path: %w", err) } return true, nil }) }, }
Functions ¶
This section is empty.
Types ¶
type Connection ¶
type Connection struct {
// path to store audit logs
Path string `json:"path,omitempty"`
// max number of audit results to store
MaxAuditResults int `json:"maxAuditResults,omitempty"`
// ClosedConnectionTTL specifies how long a failed connection remains
// in the cleanup queue before being permanently removed (not retried).
// This prevents memory leaks from accumulating failed connections.
ClosedConnectionTTL time.Duration `json:"closedConnectionTTL,omitempty"`
// File to write audit logs
File *os.File
// contains filtered or unexported fields
}
type FailedConnection ¶
FailedConnection wraps a Connection with retry metadata.
type Writer ¶
type Writer struct {
// contains filtered or unexported fields
}
func (*Writer) CloseConnection ¶
func (*Writer) CreateConnection ¶
Click to show internal directories.
Click to hide internal directories.