diff --git a/API.md b/API.md index da6615de82..9751f52584 100755 --- a/API.md +++ b/API.md @@ -43,9 +43,13 @@ in the [API.md](https://github.com/containers/libpod/blob/master/API.md) file in [func GetContainerStats(name: string) ContainerStats](#GetContainerStats) +[func GetContainerStatsWithHistory(previousStats: ContainerStats) ContainerStats](#GetContainerStatsWithHistory) + [func GetContainersByContext(all: bool, latest: bool, args: []string) []string](#GetContainersByContext) -[func GetEvents(options: EventInput) Event](#GetEvents) +[func GetContainersLogs(names: []string, follow: bool, latest: bool, since: string, tail: int, timestamps: bool) LogLine](#GetContainersLogs) + +[func GetEvents(filter: []string, since: string, until: string) Event](#GetEvents) [func GetImage(id: string) Image](#GetImage) @@ -133,6 +137,8 @@ in the [API.md](https://github.com/containers/libpod/blob/master/API.md) file in [func TagImage(name: string, tagged: string) string](#TagImage) +[func TopPod(pod: string, latest: bool, descriptors: []string) []string](#TopPod) + [func UnmountContainer(name: string, force: bool) ](#UnmountContainer) [func UnpauseContainer(name: string) string](#UnpauseContainer) @@ -169,8 +175,6 @@ in the [API.md](https://github.com/containers/libpod/blob/master/API.md) file in [type Event](#Event) -[type EventInput](#EventInput) - [type IDMap](#IDMap) [type IDMappingOptions](#IDMappingOptions) @@ -199,6 +203,8 @@ in the [API.md](https://github.com/containers/libpod/blob/master/API.md) file in [type ListPodData](#ListPodData) +[type LogLine](#LogLine) + [type MoreResponse](#MoreResponse) [type NotImplemented](#NotImplemented) @@ -237,8 +243,6 @@ in the [API.md](https://github.com/containers/libpod/blob/master/API.md) file in [error RuntimeError](#RuntimeError) -[error StreamEnded](#StreamEnded) - [error VolumeNotFound](#VolumeNotFound) [error WantsMoreRequired](#WantsMoreRequired) @@ -472,6 +476,12 @@ $ varlink call -m unix:/run/podman/io.podman/io.podman.GetContainerStats '{"name } } ~~~ +### func GetContainerStatsWithHistory +
+ +method GetContainerStatsWithHistory(previousStats: [ContainerStats](#ContainerStats)) [ContainerStats](#ContainerStats)
+GetContainerStatsWithHistory takes a previous set of container statistics and uses libpod functions +to calculate the containers statistics based on current and previous measurements. ### func GetContainersByContext
@@ -479,10 +489,15 @@ method GetContainersByContext(all: [bool](https://godoc.org/builtin#bool), lates GetContainersByContext allows you to get a list of container ids depending on all, latest, or a list of container names. The definition of latest container means the latest by creation date. In a multi- user environment, results might differ from what you expect. +### func GetContainersLogs +
+ +method GetContainersLogs(names: [[]string](#[]string), follow: [bool](https://godoc.org/builtin#bool), latest: [bool](https://godoc.org/builtin#bool), since: [string](https://godoc.org/builtin#string), tail: [int](https://godoc.org/builtin#int), timestamps: [bool](https://godoc.org/builtin#bool)) [LogLine](#LogLine)
+ ### func GetEvents
-method GetEvents(options: [EventInput](#EventInput)) [Event](#Event)
+method GetEvents(filter: [[]string](#[]string), since: [string](https://godoc.org/builtin#string), until: [string](https://godoc.org/builtin#string)) [Event](#Event)
GetEvents returns known libpod events filtered by the options provided. ### func GetImage
@@ -714,7 +729,7 @@ See also [GetContainer](#GetContainer). method ListImages() [Image](#Image)
ListImages returns information about the images that are currently in storage. -See also [InspectImage](InspectImage). +See also [InspectImage](#InspectImage). ### func ListPods
@@ -976,6 +991,11 @@ $ varlink call -m unix:/run/podman/io.podman/io.podman.StopPod '{"name": "135d71 method TagImage(name: [string](https://godoc.org/builtin#string), tagged: [string](https://godoc.org/builtin#string)) [string](https://godoc.org/builtin#string)
TagImage takes the name or ID of an image in local storage as well as the desired tag name. If the image cannot be found, an [ImageNotFound](#ImageNotFound) error will be returned; otherwise, the ID of the image is returned on success. +### func TopPod +
+ +method TopPod(pod: [string](https://godoc.org/builtin#string), latest: [bool](https://godoc.org/builtin#bool), descriptors: [[]string](#[]string)) [[]string](#[]string)
+ ### func UnmountContainer
@@ -1426,17 +1446,6 @@ status [string](https://godoc.org/builtin#string) time [string](https://godoc.org/builtin#string) type [string](https://godoc.org/builtin#string) -### type EventInput - -EventInput describes the input to obtain libpod events - -filter [[]string](#[]string) - -since [string](https://godoc.org/builtin#string) - -stream [bool](https://godoc.org/builtin#bool) - -until [string](https://godoc.org/builtin#string) ### type IDMap IDMap is used to describe user name spaces during container creation @@ -1636,6 +1645,19 @@ labels [map[string]](#map[string]) numberofcontainers [string](https://godoc.org/builtin#string) containersinfo [ListPodContainerInfo](#ListPodContainerInfo) +### type LogLine + + + +device [string](https://godoc.org/builtin#string) + +parseLogType [string](https://godoc.org/builtin#string) + +time [string](https://godoc.org/builtin#string) + +msg [string](https://godoc.org/builtin#string) + +cid [string](https://godoc.org/builtin#string) ### type MoreResponse MoreResponse is a struct for when responses from varlink requires longer output @@ -1793,9 +1815,6 @@ PodNotFound means the pod could not be found by the provided name or ID in local ### type RuntimeError RuntimeErrors generally means a runtime could not be found or gotten. -### type StreamEnded - -The Podman endpoint has closed because the stream ended. ### type VolumeNotFound VolumeNotFound means the volume could not be found by the name or ID in local storage. diff --git a/cmd/podman/varlink/io.podman.varlink b/cmd/podman/varlink/io.podman.varlink index 517a7a2a1b..5999210c8d 100644 --- a/cmd/podman/varlink/io.podman.varlink +++ b/cmd/podman/varlink/io.podman.varlink @@ -1151,7 +1151,7 @@ method GetPodsByContext(all: bool, latest: bool, args: []string) -> (pods: []str method LoadImage(name: string, inputFile: string, quiet: bool, deleteFile: bool) -> (reply: MoreResponse) # GetEvents returns known libpod events filtered by the options provided. -method GetEvents(filter: []string, since: string, stream: bool, until: string) -> (events: Event) +method GetEvents(filter: []string, since: string, until: string) -> (events: Event) # ImageNotFound means the image could not be found by the provided name or ID in local storage. error ImageNotFound (id: string, reason: string) diff --git a/libpod/events/events.go b/libpod/events/events.go index 48bbbb00ed..7db36653eb 100644 --- a/libpod/events/events.go +++ b/libpod/events/events.go @@ -219,6 +219,8 @@ func StringToStatus(name string) (Status, error) { return Create, nil case Exec.String(): return Exec, nil + case Exited.String(): + return Exited, nil case Export.String(): return Export, nil case History.String(): diff --git a/pkg/adapter/runtime_remote.go b/pkg/adapter/runtime_remote.go index 01f774dbdf..6c53d0c628 100644 --- a/pkg/adapter/runtime_remote.go +++ b/pkg/adapter/runtime_remote.go @@ -763,7 +763,11 @@ func (r *LocalRuntime) JoinOrCreateRootlessPod(pod *Pod) (bool, int, error) { // Events monitors libpod/podman events over a varlink connection func (r *LocalRuntime) Events(c *cliconfig.EventValues) error { - reply, err := iopodman.GetEvents().Send(r.Conn, uint64(varlink.More), c.Filter, c.Since, c.Stream, c.Until) + var more uint64 + if c.Stream { + more = uint64(varlink.More) + } + reply, err := iopodman.GetEvents().Send(r.Conn, more, c.Filter, c.Since, c.Until) if err != nil { return errors.Wrapf(err, "unable to obtain events") } diff --git a/pkg/varlinkapi/events.go b/pkg/varlinkapi/events.go index d3fe3d65f1..47c628eadf 100644 --- a/pkg/varlinkapi/events.go +++ b/pkg/varlinkapi/events.go @@ -10,13 +10,15 @@ import ( ) // GetEvents is a remote endpoint to get events from the event log -func (i *LibpodAPI) GetEvents(call iopodman.VarlinkCall, filter []string, since string, stream bool, until string) error { +func (i *LibpodAPI) GetEvents(call iopodman.VarlinkCall, filter []string, since string, until string) error { var ( fromStart bool eventsError error event *events.Event + stream bool ) if call.WantsMore() { + stream = true call.Continues = true } filters, err := shared.GenerateEventOptions(filter, since, until) @@ -52,5 +54,5 @@ func (i *LibpodAPI) GetEvents(call iopodman.VarlinkCall, filter []string, since break } } - return call.ReplyGetEvents(iopodman.Event{}) + return nil }