summaryrefslogtreecommitdiffhomepage
path: root/tka/limits.go
blob: a644df061b71a4cbf3f82a0201eca21cd4334aee (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
// Copyright (c) Tailscale Inc & contributors
// SPDX-License-Identifier: BSD-3-Clause

package tka

import (
	"time"
)

const (
	// Upper bound on checkpoint elements, chosen arbitrarily. Intended
	// to cap the size of large AUMs.
	maxDisablementSecrets = 32
	maxKeys               = 512

	// Max amount of metadata that can be associated with a key, chosen arbitrarily.
	// Intended to avoid people abusing TKA as a key-value score.
	maxMetaBytes = 512

	// Max iterations searching for any intersection during the sync process.
	maxSyncIter = 2000

	// Max iterations searching for a head intersection during the sync process.
	maxSyncHeadIntersectionIter = 400

	// Limit on scanning AUM trees, chosen arbitrarily.
	maxScanIterations = 2000
)

var (
	CompactionDefaults = CompactionOptions{
		MinChain: 24,                  // Keep at minimum 24 AUMs since head.
		MinAge:   14 * 24 * time.Hour, // Keep 2 weeks of AUMs.
	}
)