From 959afd37e5169f08cb3257b7799d81749bfc7a5c Mon Sep 17 00:00:00 2001 From: Chewing_Bever Date: Wed, 22 Jun 2022 08:17:58 +0200 Subject: [PATCH] refactor: renamed existing container functions to fit style --- Makefile | 3 --- containers.v | 17 ++++++----------- docker.v | 1 - 3 files changed, 6 insertions(+), 15 deletions(-) diff --git a/Makefile b/Makefile index 81b65fc..b25f105 100644 --- a/Makefile +++ b/Makefile @@ -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: diff --git a/containers.v b/containers.v index 9991e75..0aee8f4 100644 --- a/containers.v +++ b/containers.v @@ -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()? diff --git a/docker.v b/docker.v index 9eaa1a9..a171a2e 100644 --- a/docker.v +++ b/docker.v @@ -7,7 +7,6 @@ import strings import net.urllib import json import util -import time const ( socket = '/var/run/docker.sock'