Skip to content

Commit 68b2e0b

Browse files
committed
proto/config: style guide
https://developers.google.com/protocol-buffers/docs/style?hl=en Signed-off-by: Vincent Batts <[email protected]>
1 parent 716ab56 commit 68b2e0b

File tree

3 files changed

+134
-124
lines changed

3 files changed

+134
-124
lines changed

proto/config.proto

Lines changed: 50 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -5,55 +5,60 @@ package oci;
55
// independent configuration.
66
message Spec {
77
// Version is the version of the specification that is supported.
8-
optional string Version = 1;
8+
optional string version = 1;
99
// Platform is the host information for OS and Arch.
10-
optional Platform Platform = 2; // [default=77];
10+
optional Platform platform = 2; // [default=77];
1111
// Process is the container's main process.
12-
optional Process Process = 3;
12+
optional Process process = 3;
1313
// Root is the root information for the container's filesystem.
14-
optional Root Root = 4;
14+
optional Root root = 4;
1515
// Hostname is the container's host name.
16-
optional string Hostname = 5;
17-
// Mounts profile configuration for adding mounts to the container's filesystem.
18-
repeated MountPoint Mounts = 6;
16+
optional string hostname = 5;
17+
// Mounts profile configuration for adding mounts to the container's
18+
// filesystem.
19+
repeated MountPoint mounts = 6;
1920
}
2021

2122

2223
// LinuxSpec is the full specification for linux containers.
2324
message LinuxSpec {
24-
optional Spec Spec = 1;
25-
// LinuxConfig is platform specific configuration for linux based containers.
26-
optional LinuxConfig LinuxConfig = 2;
25+
optional Spec spec = 1;
26+
// LinuxConfig is platform specific configuration for linux based
27+
// containers.
28+
optional LinuxConfig linux_config = 2;
2729
}
2830

29-
// LinuxConfig contains platform specific configuration for linux based containers.
31+
// LinuxConfig contains platform specific configuration for linux based
32+
// containers.
3033
message LinuxConfig {
3134
// Capabilities are linux capabilities that are kept for the container.
32-
repeated string Capabilities = 1;
35+
repeated string capabilities = 1;
3336
}
3437

35-
// Platform specifies OS and arch information for the host system that the container
36-
// is created for.
38+
// Platform specifies OS and arch information for the host system that the
39+
// container is created for.
3740
message Platform {
3841
// OS is the operating system.
39-
optional string OS = 1;
42+
optional string os = 1;
4043
// Arch is the architecture
41-
optional string Arch = 2;
44+
optional string arch = 2;
4245
}
4346

44-
// Process contains information to start a specific application inside the container.
47+
// Process contains information to start a specific application inside the
48+
// container.
4549
message Process {
4650
// Terminal creates an interactive terminal for the container.
47-
optional bool Terminal = 1;
51+
optional bool terminal = 1;
4852
// User specifies user information for the process.
49-
optional User User = 2;
50-
// Args specifies the binary and arguments for the application to execute.
51-
repeated string Args = 3;
53+
optional User user = 2;
54+
// Args specifies the binary and arguments for the application to
55+
// execute.
56+
repeated string args = 3;
5257
// Env populates the process environment for the process.
53-
repeated string Env = 4;
58+
repeated string env = 4;
5459
// Cwd is the current working directory for the process and must be
5560
// relative to the container's root.
56-
optional string Cwd = 5;
61+
optional string cwd = 5;
5762
}
5863

5964
enum PlatformType {
@@ -62,34 +67,39 @@ enum PlatformType {
6267

6368
// User specifies user information for the process.
6469
message User {
65-
// Type so that receivers of this message can `switch` for the fields expected
66-
optional PlatformType Type = 1 [default = LINUX];
70+
// Type so that receivers of this message can `switch` for the fields
71+
// expected
72+
optional PlatformType type = 1 [default = LINUX];
6773

68-
optional LinuxUser LinuxUser = 2;
74+
optional LinuxUser linux_type = 2;
6975
}
7076

71-
// User specifies linux specific user and group information for the container's
72-
// main process.
77+
// LinuxUser specifies linux specific user and group information for the
78+
// container's main process.
7379
message LinuxUser {
74-
// UID is the user id.
75-
optional int32 UID = 1;
76-
// GID is the group id.
77-
optional int32 GID = 2;
78-
repeated int32 AdditionalGids = 3;
80+
// Uid is the user id.
81+
optional int32 uid = 1;
82+
// Gid is the group id.
83+
optional int32 gid = 2;
84+
repeated int32 additional_gids = 3;
7985
}
8086

8187
// Root contains information about the container's root filesystem on the host.
8288
message Root {
8389
// Path is the absolute path to the container's root filesystem.
84-
optional string Path = 1;
85-
// Readonly makes the root filesystem for the container readonly before the process is executed.
86-
optional bool Readonly = 2;
90+
optional string path = 1;
91+
// Readonly makes the root filesystem for the container readonly before
92+
// the process is executed.
93+
optional bool readonly = 2;
8794
}
8895

89-
// MountPoint describes a directory that may be fullfilled by a mount in the runtime.json.
96+
// MountPoint describes a directory that may be fullfilled by a mount in the
97+
// runtime.json.
9098
message MountPoint {
9199
// Name is a unique descriptive identifier for this mount point.
92-
optional string Name = 1;
93-
// Path specifies the path of the mount. The path and child directories MUST exist, a runtime MUST NOT create directories automatically to a mount point.
94-
optional string Path = 2;
100+
optional string name = 1;
101+
// Path specifies the path of the mount. The path and child directories
102+
// MUST exist, a runtime MUST NOT create directories automatically to a
103+
// mount point.
104+
optional string path = 2;
95105
}

proto/runtime_config.proto

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -8,16 +8,16 @@ message RuntimeSpec {
88
// Mounts is a mapping of names to mount configurations.
99
// Which mounts will be mounted and where should be chosen with MountPoints
1010
// in Spec.
11-
repeated MountFieldEntry Mounts = 1;
11+
repeated MountFieldEntry mounts = 1;
1212
// Hooks are the commands run at various lifecycle events of the container.
13-
optional Hooks Hooks = 2;
13+
optional Hooks hooks = 2;
1414
}
1515

1616
// LinuxRuntimeSpec is the full specification for linux containers.
1717
message LinuxRuntimeSpec {
18-
optional RuntimeSpec RuntimeSpec = 1;
18+
optional RuntimeSpec runtime_spec = 1;
1919
// LinuxRuntime is platform specific configuration for linux based containers.
20-
optional oci.LinuxRuntime Linux = 2;
20+
optional oci.LinuxRuntime linux = 2;
2121
}
2222

2323
// MountFieldEntry is more backwards compatible protobuf associative map (than map<string, Mount>)
@@ -29,26 +29,26 @@ message MountFieldEntry {
2929
// Mount specifies a mount for a container
3030
message Mount {
3131
// Type specifies the mount kind.
32-
optional string Type = 1;
32+
optional string type = 1;
3333
// Source specifies the source path of the mount. In the case of bind mounts on
3434
// linux based systems this would be the file on the host.
35-
optional string Source = 2;
35+
optional string source = 2;
3636
// Options are fstab style mount options.
37-
repeated string Options = 3;
37+
repeated string options = 3;
3838
}
3939

4040
// Hook specifies a command that is run at a particular event in the lifecycle of a container
4141
message Hook {
42-
optional string Path = 1;
43-
repeated string Args = 2;
44-
repeated string Env = 3;
42+
optional string path = 1;
43+
repeated string args = 2;
44+
repeated string env = 3;
4545
}
4646

4747
// Hooks for container setup and teardown
4848
message Hooks {
4949
// Prestart is a list of hooks to be run before the container process is executed.
5050
// On Linux, they are run after the container namespaces are created.
51-
repeated Hook Prestart = 1;
51+
repeated Hook prestart = 1;
5252
// Poststop is a list of hooks to be run after the container process exits.
53-
repeated Hook Poststop = 2;
53+
repeated Hook poststop = 2;
5454
}

0 commit comments

Comments
 (0)