syntax = "proto3";

package containerd.events;

import weak "gogoproto/gogo.proto";
import "google/protobuf/timestamp.proto";
import "github.com/containerd/containerd/api/types/mount.proto";
import weak "github.com/containerd/containerd/protobuf/plugin/fieldpath.proto";

option go_package = "github.com/containerd/containerd/api/events;events";
option (containerd.plugin.fieldpath_all) = true;

message TaskCreate {
	string container_id = 1;
	string bundle = 2;
	repeated containerd.types.Mount rootfs = 3;
	TaskIO io = 4 [(gogoproto.customname) = "IO"];
	string checkpoint = 5;
	uint32 pid = 6;
}

message TaskStart {
	string container_id = 1;
	uint32 pid = 2;
}

message TaskDelete {
	string container_id = 1;
	uint32 pid = 2;
	uint32 exit_status = 3;
	google.protobuf.Timestamp exited_at = 4 [(gogoproto.stdtime) = true, (gogoproto.nullable) = false];
	// id is the specific exec. By default if omitted will be `""` thus matches
	// the init exec of the task matching `container_id`.
	string id = 5;
}

message TaskIO {
	string stdin = 1;
	string stdout = 2;
	string stderr = 3;
	bool terminal = 4;
}

message TaskExit {
	string container_id = 1;
	string id = 2;
	uint32 pid = 3;
	uint32 exit_status = 4;
	google.protobuf.Timestamp exited_at = 5 [(gogoproto.stdtime) = true, (gogoproto.nullable) = false];
}

message TaskOOM {
	string container_id = 1;
}

message TaskExecAdded {
	string container_id = 1;
	string exec_id = 2;
}

message TaskExecStarted {
	string container_id = 1;
	string exec_id = 2;
	uint32 pid = 3;
}

message TaskPaused {
	string container_id = 1;
}

message TaskResumed {
	string container_id = 1;
}

message TaskCheckpointed {
	string container_id = 1;
	string checkpoint = 2;
}
