diff options
Diffstat (limited to 'internal/parquet/schema.go')
| -rw-r--r-- | internal/parquet/schema.go | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/internal/parquet/schema.go b/internal/parquet/schema.go index 2ede444..62d448b 100644 --- a/internal/parquet/schema.go +++ b/internal/parquet/schema.go @@ -1,7 +1,9 @@ package parquet import ( + "os" "strconv" + "time" "ior/internal/flags" "ior/internal/streamrow" @@ -35,6 +37,20 @@ type FileMetadata struct { IORVersion string } +// NewFileMetadata constructs file-level metadata for a parquet trace file, +// populating the hostname, timestamp, version, and recording mode. +func NewFileMetadata(mode string) FileMetadata { + meta := FileMetadata{ + StartedAtUnixNano: uint64(time.Now().UnixNano()), + Mode: mode, + IORVersion: flags.Version, + } + if hostname, err := os.Hostname(); err == nil { + meta.Hostname = hostname + } + return meta +} + // RecordFromStream converts one shared stream row into the persisted format. func RecordFromStream(row streamrow.Row, filterEpoch uint64) Record { return Record{ |
