github.com/NVIDIA/aistore@v1.3.23-0.20240517131212-7df6609be51d/api/apc/compression.go (about)

     1  // Package apc: API control messages and constants
     2  /*
     3   * Copyright (c) 2018-2022, NVIDIA CORPORATION. All rights reserved.
     4   */
     5  package apc
     6  
     7  import (
     8  	"github.com/NVIDIA/aistore/cmn/cos"
     9  )
    10  
    11  // NOTE:
    12  // LZ4 block and frame formats: http://fastcompression.blogspot.com/2013/04/lz4-streaming-format-final.html
    13  
    14  // Compression enum
    15  const (
    16  	CompressAlways = "always"
    17  	CompressNever  = "never"
    18  )
    19  
    20  // sent via req.Header.Set(apc.HdrCompress, LZ4Compression)
    21  // (alternative to lz4 compressions upon popular request)
    22  const LZ4Compression = "lz4"
    23  
    24  var SupportedCompression = []string{CompressNever, CompressAlways}
    25  
    26  func IsValidCompression(c string) bool { return c == "" || cos.StringInSlice(c, SupportedCompression) }