Documentation
¶
Index ¶
- type Option
- type ProgressLog
- func (p *ProgressLog) AddEntitlementsProgress(resourceType string, count int)
- func (p *ProgressLog) AddGrantsProgress(resourceType string, count int)
- func (p *ProgressLog) AddResourceTypes(count int)
- func (p *ProgressLog) AddResources(resourceType string, count int)
- func (p *ProgressLog) LogEntitlementsProgress(ctx context.Context, resourceType string)
- func (p *ProgressLog) LogExpandProgress(ctx context.Context, actions []*expand.EntitlementGraphAction)
- func (p *ProgressLog) LogGrantsProgress(ctx context.Context, resourceType string)
- func (p *ProgressLog) LogResourceTypesProgress(ctx context.Context)
- func (p *ProgressLog) LogResourcesProgress(ctx context.Context, resourceType string)
- func (p *ProgressLog) SetDBSizeProvider(provider connectorstore.DBSizeProvider)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Option ¶
type Option func(*ProgressLog)
func WithDBSizeProvider ¶ added in v0.8.27
func WithDBSizeProvider(p connectorstore.DBSizeProvider) Option
WithDBSizeProvider attaches an optional connectorstore.DBSizeProvider to this ProgressLog. When set, LogExpandProgress will include decompressed_bytes and decompressed_bytes_delta (growth since the previous log) in its output.
This is one of two attachment points — the syncer also calls SetDBSizeProvider after loadStore resolves the store, because many callers construct NewSyncer via WithC1ZPath (store is nil at NewProgressCounts time) and can only be wired once loadStore has run.
nil is a valid value (equivalent to not setting it) and the log falls back to the pre-existing action-count-only output.
The log is primarily useful during long grant expansions for catching pathological growth before the decoder cap trips on a subsequent read. Compare the emitted bytes against BATON_DECODER_MAX_DECODED_SIZE_MB (default 3 GiB; see pkg/dotc1z/decoder.go). If a tenant's db size is approaching that cap, the per-tenant WithDecoderMaxDecodedSize override is the operator's next step.
func WithLogFrequency ¶
func WithLogger ¶
func WithSequentialMode ¶
WithSequentialMode enables/disables mutex protection for sequential sync.
type ProgressLog ¶
type ProgressLog struct {
// contains filtered or unexported fields
}
func NewProgressCounts ¶
func NewProgressCounts(ctx context.Context, opts ...Option) *ProgressLog
func (*ProgressLog) AddEntitlementsProgress ¶
func (p *ProgressLog) AddEntitlementsProgress(resourceType string, count int)
AddEntitlementsProgress safely adds to the entitlements progress count for a specific resource type.
func (*ProgressLog) AddGrantsProgress ¶
func (p *ProgressLog) AddGrantsProgress(resourceType string, count int)
AddGrantsProgress safely adds to the grants progress count for a specific resource type.
func (*ProgressLog) AddResourceTypes ¶
func (p *ProgressLog) AddResourceTypes(count int)
AddResourceTypes safely adds to the resource types count.
func (*ProgressLog) AddResources ¶
func (p *ProgressLog) AddResources(resourceType string, count int)
AddResources safely adds to the resources count for a specific resource type.
func (*ProgressLog) LogEntitlementsProgress ¶
func (p *ProgressLog) LogEntitlementsProgress(ctx context.Context, resourceType string)
func (*ProgressLog) LogExpandProgress ¶
func (p *ProgressLog) LogExpandProgress(ctx context.Context, actions []*expand.EntitlementGraphAction)
LogExpandProgress emits an Info-level "Expanding grants" log at most once per maxLogFrequency window. When a DBSizeProvider is attached (production: *dotc1z.C1File), includes the live uncompressed db size and the growth since the previous emitted log (`decompressed_bytes_delta`) — the signal that surfaces non-linear expansion growth before the next saveC1z.
All expand-log state (lastActionLog, dbSize, lastLoggedDBSize, hasLoggedDBSize) is guarded by p.expandMu, a mutex dedicated to this function. It is deliberately separate from p.mu so the provider's stat calls can run under the lock (simple defer pattern) without serialising against the sync-hot-path counters (AddResources / AddGrantsProgress), which contend on p.mu.
func (*ProgressLog) LogGrantsProgress ¶
func (p *ProgressLog) LogGrantsProgress(ctx context.Context, resourceType string)
func (*ProgressLog) LogResourceTypesProgress ¶
func (p *ProgressLog) LogResourceTypesProgress(ctx context.Context)
func (*ProgressLog) LogResourcesProgress ¶
func (p *ProgressLog) LogResourcesProgress(ctx context.Context, resourceType string)
func (*ProgressLog) SetDBSizeProvider ¶ added in v0.8.27
func (p *ProgressLog) SetDBSizeProvider(provider connectorstore.DBSizeProvider)
SetDBSizeProvider updates the DBSizeProvider attached to this ProgressLog. Intended for callers (notably the syncer) that construct the ProgressLog before the store is known (e.g. WithC1ZPath path, where the store is loaded from disk later by loadStore). Idempotent; safe to call multiple times — the last non-nil value wins if called from multiple sites. Passing nil clears the provider.