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

Commit

Permalink
Merge branch 'main' into debug-repl
Browse files Browse the repository at this point in the history
  • Loading branch information
chriso committed May 30, 2023
2 parents f67874e + 6569b3a commit d21775f
Show file tree
Hide file tree
Showing 22 changed files with 1,341 additions and 552 deletions.
31 changes: 4 additions & 27 deletions 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 Expand Up @@ -39,32 +42,6 @@ table Record {
function_call:[ubyte];
}

// Details about a function call.
table FunctionCall {
// State of the WebAssembly stack before and after the function was called.
// The first {param_count} values are the input parameters, and the remaining
// values are the return values.
stack:[ulong];
// Captured sections of the WebAssembly module's linear memory, stored
// contiguously and indexed by {memory_access}.
memory:[ubyte];
// Ordered collection of memory reads and writes made by the function.
memory_access:[MemoryAccess];
}

// MemoryAccess represents the capture of a section of memory.
struct MemoryAccess {
// Byte offset in the WebAssembly module's linear memory where the memory
// access starts.
offset:uint;
// Byte offset into {FunctionCall.memory}. The length of the captured memory
// can be derived by comparing the {index_offset} with that of the next
// {FunctionCall.memory_access}. The length of the final memory region can
// be derived by comparing the {index_offset} with the length of
// {FunctionCall.memory}.
index_offset:uint;
}

root_type RecordBatch;

file_identifier "TL.0";
Expand Down
212 changes: 31 additions & 181 deletions format/logsegment/logsegment_generated.go

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

13 changes: 11 additions & 2 deletions format/timecraft.go
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ const (
TypeTimecraftRuntime MediaType = "application/vnd.timecraft.runtime.v1+json"
TypeTimecraftConfig MediaType = "application/vnd.timecraft.config.v1+json"
TypeTimecraftProcess MediaType = "application/vnd.timecraft.process.v1+json"
TypeTimecraftProfile MediaType = "application/vnd.timecraft.profile.v1+pprof"
TypeTimecraftManifest MediaType = "application/vnd.timecraft.manifest.v1+json"
TypeTimecraftModule MediaType = "application/vnd.timecraft.module.v1+wasm"
)
Expand Down Expand Up @@ -197,8 +198,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 +216,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
Loading

0 comments on commit d21775f

Please sign in to comment.