...

Source file src/edge-infra.dev/pkg/edge/datasync/apis/v1alpha1/compaction.go

Documentation: edge-infra.dev/pkg/edge/datasync/apis/v1alpha1

     1  package v1alpha1
     2  
     3  // DatabaseCompactionConfig from https://docs.couchdb.org/en/stable/config/compaction.html
     4  type DatabaseCompactionConfig struct {
     5  	// Specifies the copy buffer’s maximum size in bytes:
     6  	DocBufferSize *int `json:"docBufferSize,omitempty" ini:"doc_buffer_size,omitempty"`
     7  	// Triggers a checkpoint after the specified amount of bytes were successfully copied to the compacted database:
     8  	CheckpointAfter *int `json:"checkpointAfter,omitempty" ini:"checkpoint_after,omitempty"`
     9  }
    10  
    11  type ViewCompactionConfig struct {
    12  	// Specifies maximum copy buffer size in bytes used during compaction:
    13  	KeyValueBufferSize *int `json:"keyValueBufferSize,omitempty" ini:"keyvalue_buffer_size,omitempty"`
    14  }
    15  
    16  type SmooshConfig struct {
    17  	// A comma-delimited list of channels that are sent the names of database files when those files are updated.
    18  	DBChannels []string `json:"dbChannels,omitempty" ini:"db_channels,omitempty" delim:","`
    19  
    20  	// A comma-delimited list of channels that are sent the names of secondary index files when those files are updated
    21  	ViewChannels []string `json:"viewChannels,omitempty" ini:"view_channels,omitempty" delim:","`
    22  
    23  	// Special channel for compaction cleanup: index_cleanup, from https://docs.couchdb.org/en/stable/maintenance/compaction.html#channel-configuration
    24  	CleanupChannels []string `json:"cleanupChannels,omitempty" ini:"cleanup_channels,omitempty" delim:","`
    25  
    26  	// Log level of compaction
    27  	CompactionLogLevel *LogLevel `json:"compactionLogLevel,omitempty" ini:"compaction_log_level,omitempty" delim:","`
    28  
    29  	// Smoosh queue persistence. This allows resuming smoosh operations after a node restart. from: https://docs.couchdb.org/en/stable/whatsnew/3.3.html#id3, https://github.com/apache/couchdb/blob/dce6769edf141c36d408bddcd48082e91ae2f7ab/rel/overlay/etc/default.ini#L793
    30  	Persist *bool `json:"persist,omitempty" ini:"persist,omitempty"`
    31  
    32  	// The number of minutes that the (expensive) priority calculation on an individual can be stale for before it is recalculated. Defaults to 5.
    33  	Staleness *int `json:"staleness,omitempty" ini:"staleness,omitempty"`
    34  
    35  	// If set to true, the compaction daemon will delete the files for indexes that are no longer associated with any design document
    36  	CleanupIndexFiles *bool `json:"capacity,omitempty" ini:"cleanup_index_files,omitempty"`
    37  
    38  	// These settings control the resource allocation for a given compaction channel.
    39  	Channels map[string]*SmooshChannelConfig `json:"channels,omitempty" ini:"-"`
    40  }
    41  
    42  type SmooshChannelConfig struct {
    43  	// The maximum number of items the channel can hold (lowest priority item is removed to make room for new items). Defaults to 9999
    44  	Capacity *int `json:"capacity,omitempty" ini:"capacity,omitempty"`
    45  	// The maximum number of jobs that can run concurrently in this channel. Defaults to 1.
    46  	Concurrency *int `json:"concurrency,omitempty" ini:"concurrency,omitempty"`
    47  
    48  	//The time period during which this channel is allowed to execute compactions
    49  	// The value for each of these parameters must obey the format HH:MM with HH in [0..23] and MM in [0..59]
    50  	From *string `json:"from,omitempty" ini:"from,omitempty"`
    51  	To   *string `json:"to,omitempty" ini:"to,omitempty"`
    52  
    53  	// If set to true, any compaction that is still running after the end of the allowed perio will be suspended, and then resumed during the next window
    54  	StrictWindow *bool `json:"strictWindow,omitempty" ini:"strict_window,omitempty"`
    55  
    56  	// Each item must have a priority lower than this to be enqueued. Defaults to infinity.
    57  	MaxPriority *float64 `json:"maxPriority,omitempty" ini:"max_priority,omitempty"`
    58  
    59  	// The item must be no larger than this many bytes in length to be enqueued. Defaults to infinity.
    60  	MaxSize *float64 `json:"maxSize,omitempty" ini:"max_size,omitempty"`
    61  
    62  	// The item must have a priority at least this high to be enqueued. Defaults to 5.0 for ratio and 16 MB for slack.
    63  	MinPriority *float64 `json:"minPriority,omitempty" ini:"min_priority,omitempty"`
    64  
    65  	// The minimum number of changes since last compaction before the item will be enqueued. Defaults to 0. Currently only works for databases.
    66  	MinChanges *float64 `json:"minChanges,omitempty" ini:"min_changes,omitempty"`
    67  
    68  	// The item must be at least this many bytes in length to be enqueued. Defaults to 1mb (1048576 bytes).
    69  	MinSize *float64 `json:"minSize,omitempty" ini:"min_size,omitempty"`
    70  
    71  	// The method used to calculate priority. Can be ratio (calculated as sizes.file/sizes.active) or slack (calculated as sizes.file - sizes.active). Defaults to ratio.
    72  	Priority *string `json:"priority,omitempty" ini:"priority,omitempty"`
    73  }
    74  

View as plain text