github.com/NVIDIA/aistore@v1.3.23-0.20240517131212-7df6609be51d/cmn/cos/oah.go (about)

     1  // Package cos provides common low-level types and utilities for all aistore projects
     2  /*
     3   * Copyright (c) 2018-2023, NVIDIA CORPORATION. All rights reserved.
     4   */
     5  package cos
     6  
     7  // OAH: object attrs holder
     8  
     9  type (
    10  	OAH interface {
    11  		SizeBytes(special ...bool) int64
    12  		Version(special ...bool) string
    13  		Checksum() *Cksum
    14  		AtimeUnix() int64
    15  		GetCustomMD() StrKVs
    16  		GetCustomKey(key string) (val string, exists bool)
    17  		SetCustomKey(k, v string)
    18  		String() string
    19  	}
    20  	// convenience/shortcut
    21  	SimpleOAH struct {
    22  		Size  int64
    23  		Atime int64
    24  	}
    25  )
    26  
    27  func (s SimpleOAH) SizeBytes(...bool) int64 { return s.Size }
    28  func (s SimpleOAH) AtimeUnix() int64        { return s.Atime }
    29  
    30  func (SimpleOAH) Version(...bool) string             { return "" }
    31  func (SimpleOAH) Checksum() *Cksum                   { return nil }
    32  func (SimpleOAH) GetCustomMD() StrKVs                { return nil }
    33  func (SimpleOAH) GetCustomKey(string) (string, bool) { return "", false }
    34  func (SimpleOAH) SetCustomKey(_, _ string)           {}
    35  func (SimpleOAH) String() string                     { return "" }