write

fun <T> write(channel: LogChannel<T>, obj: T)

Writes an object to the specified channel, stamped with the current timestamp.

If this writer has no channel with that name yet, it adds one first.

Parameters

T

The type of the object being written

channel

The channel to write to

obj

The object to write


fun <T> write(channel: LogChannel<T>, obj: T, timestamp: Long)

Writes an object to the specified channel, stamped with timestamp.

Use this when the value was produced earlier than it is written, or when several writers must share one timestamp. Take it from the same clock for every write to a log, such as this writer's timestamp, because readers compare them.

Parameters

T

The type of the object being written

channel

The channel to write to

obj

The object to write

timestamp

When the value was produced, in nanoseconds


fun write(channelName: String, obj: Any, type: KType)

Writes an object to a channel identified by name, inferring the schema from type instead of from obj's erased runtime class.

The reified write extension calls this. Call it directly if you already have a KType.

type only matters when it has type arguments, which the runtime class can't supply. Otherwise this uses FateSchema.schemaOfClass on obj.javaClass. A value whose static type is a supertype such as Any, Number or an interface therefore still gets its concrete schema.

Parameters

channelName

The name of the channel to write to

obj

The object to write

type

The static type of obj

Throws

if the channel already exists and was created from a different parameterized type