Explorar el Código

Document FromSource and FromStore on Allocation and Asset types

Niko Kovacevic hace 5 años
padre
commit
b0da65ba2b
Se han modificado 2 ficheros con 10 adiciones y 4 borrados
  1. 2 2
      pkg/kubecost/allocation.go
  2. 8 2
      pkg/kubecost/asset.go

+ 2 - 2
pkg/kubecost/allocation.go

@@ -655,7 +655,7 @@ type AllocationSet struct {
 	allocations  map[string]*Allocation
 	allocations  map[string]*Allocation
 	externalKeys map[string]bool
 	externalKeys map[string]bool
 	idleKeys     map[string]bool
 	idleKeys     map[string]bool
-	FromSource   string
+	FromSource   string // stores the name of the source used to compute the data
 	Window       Window
 	Window       Window
 	Warnings     []string
 	Warnings     []string
 	Errors       []string
 	Errors       []string
@@ -2242,7 +2242,7 @@ func (as *AllocationSet) accumulate(that *AllocationSet) (*AllocationSet, error)
 type AllocationSetRange struct {
 type AllocationSetRange struct {
 	sync.RWMutex
 	sync.RWMutex
 	allocations []*AllocationSet
 	allocations []*AllocationSet
-	FromStore   string
+	FromStore   string // stores the name of the store used to retrieve the data
 }
 }
 
 
 // NewAllocationSetRange instantiates a new range composed of the given
 // NewAllocationSetRange instantiates a new range composed of the given

+ 8 - 2
pkg/kubecost/asset.go

@@ -2532,7 +2532,7 @@ type AssetSet struct {
 	sync.RWMutex
 	sync.RWMutex
 	aggregateBy []string
 	aggregateBy []string
 	assets      map[string]Asset
 	assets      map[string]Asset
-	FromSource  string
+	FromSource  string // stores the name of the source used to compute the data
 	Window      Window
 	Window      Window
 	Warnings    []string
 	Warnings    []string
 	Errors      []string
 	Errors      []string
@@ -2925,12 +2925,18 @@ func (as *AssetSet) accumulate(that *AssetSet) (*AssetSet, error) {
 	return acc, nil
 	return acc, nil
 }
 }
 
 
+// AssetSetRange is a thread-safe slice of AssetSets. It is meant to
+// be used such that the AssetSets held are consecutive and coherent with
+// respect to using the same aggregation properties, UTC offset, and
+// resolution. However these rules are not necessarily enforced, so use wisely.
 type AssetSetRange struct {
 type AssetSetRange struct {
 	sync.RWMutex
 	sync.RWMutex
 	assets    []*AssetSet
 	assets    []*AssetSet
-	FromStore string
+	FromStore string // stores the name of the store used to retrieve the data
 }
 }
 
 
+// NewAssetSetRange instantiates a new range composed of the given
+// AssetSets in the order provided.
 func NewAssetSetRange(assets ...*AssetSet) *AssetSetRange {
 func NewAssetSetRange(assets ...*AssetSet) *AssetSetRange {
 	return &AssetSetRange{
 	return &AssetSetRange{
 		assets: assets,
 		assets: assets,