Skip to content
This repository has been archived by the owner on Feb 17, 2024. It is now read-only.

Commit

Permalink
Merge pull request #32 from stealthrocket/timecraft-resource-log
Browse files Browse the repository at this point in the history
timecraft: add log resource type to get and describe commands
  • Loading branch information
achille-roussel committed May 30, 2023
2 parents 07387b8 + 8905c14 commit fe71750
Show file tree
Hide file tree
Showing 15 changed files with 499 additions and 80 deletions.
5 changes: 4 additions & 1 deletion format/logsegment/logsegment.fbs
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,11 @@ table RecordBatch {
// Logical offset of the first record in this batch.
first_offset:long;
// Monotonic timestamp of the first record in this batch, relative to the process start
// time of the function invocation time (expressed in nanoseconds).
// time (expressed in nanoseconds).
first_timestamp:long;
// Monotonic timestamp of the last record in this batch, relative to the process start
// time (expressed in nanoseconds).
last_timestamp:long;
// Size of the compressed records following the record batch (in bytes).
compressed_size:uint;
// Uncompressed size of the records (in bytes).
Expand Down
47 changes: 31 additions & 16 deletions format/logsegment/logsegment_generated.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 10 additions & 2 deletions format/timecraft.go
Original file line number Diff line number Diff line change
Expand Up @@ -197,8 +197,10 @@ func jsonDecode(b []byte, value any) error {
}

type Manifest struct {
Process *Descriptor `json:"process" yaml:"process"`
StartTime time.Time `json:"startTime" yaml:"startTime"`
ProcessID UUID `json:"-" yaml:"-"`
StartTime time.Time `json:"startTime" yaml:"startTime"`
Process *Descriptor `json:"process" yaml:"process"`
Segments []LogSegment `json:"segments,omitempty" yaml:"segments,omitempty"`
}

func (m *Manifest) ContentType() MediaType {
Expand All @@ -213,6 +215,12 @@ func (m *Manifest) UnmarshalResource(b []byte) error {
return jsonDecode(b, m)
}

type LogSegment struct {
Number int `json:"number" yaml:"number"`
Size int64 `json:"size" yaml:"size"`
CreatedAt time.Time `json:"createdAt" yaml:"createdAt"`
}

var (
_ ResourceMarshaler = (*Descriptor)(nil)
_ ResourceMarshaler = (*Module)(nil)
Expand Down
2 changes: 1 addition & 1 deletion format/types/types.fbs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ namespace types;
// Compression is the enumeration representing the supported compression
// algorithms for data sections of log snapshots.
enum Compression:uint {
Uncompressed, Snappy, Zstd
uncompressed, snappy, zstd
}

// Hash represents a OCI hash which pairs an algorithm name to a digest.
Expand Down
18 changes: 9 additions & 9 deletions format/types/types_generated.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit fe71750

Please sign in to comment.