refactor: renamed existing container functions to fit style
ci/woodpecker/push/lint Pipeline was successful Details

jef
Jef Roosens 2022-06-22 08:17:58 +02:00
parent 4fe19d8f6a
commit 959afd37e5
Signed by: Jef Roosens
GPG Key ID: B75D4F293C7052DB
3 changed files with 6 additions and 15 deletions

View File

@ -22,9 +22,6 @@ api-docs:
.PHONY: lint
lint:
$(V) fmt -verify .
$(V) vet -W .
$(V_PATH) missdoc -p .
@ [ $$($(V_PATH) missdoc -p . | wc -l) = 0 ]
.PHONY: fmt
fmt:

View File

@ -61,7 +61,7 @@ pub struct ContainerListItem {
created i64 [json: Created]
ports []Port [json: Ports]
size_rw i64 [json: SizeRw]
size_root_fs i64 [json: sizeRootFs]
size_root_fs i64 [json: SizeRootFs]
labels map[string]string [json: Labels]
state string [json: State]
status string [json: Status]
@ -93,8 +93,7 @@ pub:
warnings []string [json: Warnings]
}
// create_container creates a new container with the given config.
pub fn (mut d DockerConn) create_container(c NewContainer) ?CreatedContainer {
pub fn (mut d DockerConn) container_create(c NewContainer) ?CreatedContainer {
d.send_request_with_json(Method.post, '/containers/create', c)?
head, res := d.read_response()?
@ -110,7 +109,7 @@ pub fn (mut d DockerConn) create_container(c NewContainer) ?CreatedContainer {
}
// start_container starts the container with the given id.
pub fn (mut d DockerConn) start_container(id string) ? {
pub fn (mut d DockerConn) container_start(id string) ? {
d.send_request(Method.post, 'containers/$id/start')?
head, body := d.read_response()?
@ -139,8 +138,7 @@ pub mut:
end_time time.Time [skip]
}
// inspect_container returns detailed information for a given container.
pub fn (mut d DockerConn) inspect_container(id string) ?ContainerInspect {
pub fn (mut d DockerConn) container_inspect(id string) ?ContainerInspect {
d.send_request(Method.get, 'containers/$id/json')?
head, body := d.read_response()?
@ -162,8 +160,7 @@ pub fn (mut d DockerConn) inspect_container(id string) ?ContainerInspect {
return data
}
// remove_container removes the container with the given id.
pub fn (mut d DockerConn) remove_container(id string) ? {
pub fn (mut d DockerConn) container_remove(id string) ? {
d.send_request(Method.delete, 'containers/$id')?
head, body := d.read_response()?
@ -174,9 +171,7 @@ pub fn (mut d DockerConn) remove_container(id string) ? {
}
}
// get_container_logs returns a reader object allowing access to the
// container's logs.
pub fn (mut d DockerConn) get_container_logs(id string) ?&StreamFormatReader {
pub fn (mut d DockerConn) container_get_logs(id string) ?&StreamFormatReader {
d.send_request(Method.get, 'containers/$id/logs?stdout=true&stderr=true')?
head := d.read_response_head()?

View File

@ -7,7 +7,6 @@ import strings
import net.urllib
import json
import util
import time
const (
socket = '/var/run/docker.sock'