github.com/m3db/m3@v1.5.0/src/dbnode/retention/types.go (about)

     1  // Copyright (c) 2016 Uber Technologies, Inc.
     2  //
     3  // Permission is hereby granted, free of charge, to any person obtaining a copy
     4  // of this software and associated documentation files (the "Software"), to deal
     5  // in the Software without restriction, including without limitation the rights
     6  // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
     7  // copies of the Software, and to permit persons to whom the Software is
     8  // furnished to do so, subject to the following conditions:
     9  //
    10  // The above copyright notice and this permission notice shall be included in
    11  // all copies or substantial portions of the Software.
    12  //
    13  // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
    14  // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
    15  // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
    16  // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
    17  // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
    18  // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
    19  // THE SOFTWARE.
    20  
    21  package retention
    22  
    23  import (
    24  	"time"
    25  )
    26  
    27  // Options represents the options for retention
    28  type Options interface {
    29  	// Validate validates the options
    30  	Validate() error
    31  
    32  	// Equal returns a flag indicating if the other value is the same as this one
    33  	Equal(value Options) bool
    34  
    35  	// SetRetentionPeriod sets how long we intend to keep data in memory
    36  	SetRetentionPeriod(value time.Duration) Options
    37  
    38  	// RetentionPeriod returns how long we intend to keep data in memory
    39  	RetentionPeriod() time.Duration
    40  
    41  	// SetFutureRetentionPeriod sets how long we intend to keep data in memory
    42  	// in the future if cold writes are enabled.
    43  	SetFutureRetentionPeriod(value time.Duration) Options
    44  
    45  	// FutureRetentionPeriod returns how long we intend to keep data in memory
    46  	// in the future if cold writes are enabled.
    47  	FutureRetentionPeriod() time.Duration
    48  
    49  	// SetBlockSize sets the blockSize
    50  	SetBlockSize(value time.Duration) Options
    51  
    52  	// BlockSize returns the blockSize
    53  	BlockSize() time.Duration
    54  
    55  	// SetBufferFuture sets the bufferFuture
    56  	SetBufferFuture(value time.Duration) Options
    57  
    58  	// BufferFuture returns the bufferFuture
    59  	BufferFuture() time.Duration
    60  
    61  	// SetBufferPast sets the bufferPast
    62  	SetBufferPast(value time.Duration) Options
    63  
    64  	// BufferPast returns the bufferPast
    65  	BufferPast() time.Duration
    66  
    67  	// SetBlockDataExpiry sets the block data expiry mode
    68  	SetBlockDataExpiry(on bool) Options
    69  
    70  	// BlockDataExpiry returns the block data expiry mode
    71  	BlockDataExpiry() bool
    72  
    73  	// SetBlockDataExpiryAfterNotAccessedPeriod sets the period that blocks data should
    74  	// be expired after not being accessed for a given duration
    75  	SetBlockDataExpiryAfterNotAccessedPeriod(period time.Duration) Options
    76  
    77  	// BlockDataExpiryAfterNotAccessedPeriod returns the period that blocks data should
    78  	// be expired after not being accessed for a given duration
    79  	BlockDataExpiryAfterNotAccessedPeriod() time.Duration
    80  }