{"modulePath":"github.com/cloudzero/cloudzero-agent","version":"v1.1.0-rc-1","isLatest":false,"isStandardLibrary":false,"goos":"all","goarch":"all","docs":"# package store\n\nPackage store provides storage functionality.\n\n## Constants\n\n```go\nconst (\n\tCostContentIdentifier          = \"metrics\"\n\tObservabilityContentIdentifier = \"observability\"\n)\n```\n\n## Functions\n\n```go\nfunc NewBus() types.Bus\n```\nNewBus creates a new Bus instance\n\n```go\nfunc NewParquetStreamer(input io.Reader) io.ReadCloser\n```\nNewParquetStreamer reads a Brotli-compressed JSON file containing an array of Metrics, and returns a reader with the data transcoded to Snappy-compressed Parquet.\n\n## Types\n\n```go\ntype DiskStore struct {\n\t// contains filtered or unexported fields\n}\n```\nDiskStore is a data store intended to be backed by a disk. Currently, data is stored in Brotli-compressed JSON, but transcoded to Snappy-compressed Parquet\n\n```go\nfunc NewDiskStore(settings config.Database, opts ...DiskStoreOpt) (*DiskStore, error)\n```\nNewDiskStore initializes a DiskStore with a directory path and row limit\n\n```go\nfunc (d *DiskStore) All(ctx context.Context, file string) (types.MetricRange, error)\n```\nAll retrieves all metrics from uncompacted .json.br files, excluding the active and compressed files. It reads the data into memory and returns a MetricRange.\n\n```go\nfunc (d *DiskStore) Flush() error\n```\nFlush finalizes the current writer, writes all buffered data to disk, and renames the file\n\n```go\nfunc (d *DiskStore) GetFiles(paths ...string) ([]string, error)\n```\n\n```go\nfunc (d *DiskStore) GetUsage(limit uint64, paths ...string) (*types.StoreUsage, error)\n```\nGetUsage gathers disk usage stats using syscall.Statfs. paths will be used as \\`filepath.Join(paths...)\\`\n\n```go\nfunc (d *DiskStore) ListFiles(paths ...string) ([]os.DirEntry, error)\n```\n\n```go\nfunc (d *DiskStore) Pending() int\n```\nPending returns the count of buffered rows not yet written to disk\n\n```go\nfunc (d *DiskStore) Put(ctx context.Context, metrics ...types.Metric) error\n```\nPut appends metrics to the JSON file, creating a new file if the row limit is reached\n\n```go\nfunc (d *DiskStore) Walk(loc string, process filepath.WalkFunc) error\n```\nWalk will run \\`process\\` to walk the file tree\n\n```go\ntype DiskStoreOpt = func(d *DiskStore) error\n```\n\n```go\nfunc WithContentIdentifier(identifier string) DiskStoreOpt\n```\n\n```go\ntype MetricFile struct {\n\t*os.File // wrapper around an os.File\n\t// contains filtered or unexported fields\n}\n```\n\n```go\nfunc NewMetricFile(path string) (*MetricFile, error)\n```\n\n```go\nfunc (f *MetricFile) Close() error\n```\n\n```go\nfunc (f *MetricFile) Location() (string, error)\n```\n\n```go\nfunc (f *MetricFile) Read(p []byte) (int, error)\n```\n\n```go\nfunc (f *MetricFile) Rename(new string) error\n```\n\n```go\nfunc (f *MetricFile) Size() (int64, error)\n```\nSize returns the size of the file.\n\n```go\nfunc (f *MetricFile) UniqueID() string\n```\n\n","path":"github.com/cloudzero/cloudzero-agent/app/store","name":"store","synopsis":"Package store provides storage functionality.","isRedistributable":true}
