-
Notifications
You must be signed in to change notification settings - Fork 24
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #173 from navidys/image_cache
cache scrapping of images
- Loading branch information
Showing
9 changed files
with
124 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
#!/usr/bin/env bash | ||
${CPP:-${CC:-cc} -E} ${CPPFLAGS} - > /dev/null 2> /dev/null << EOF | ||
#include <btrfs/ioctl.h> | ||
EOF | ||
if test $? -ne 0 ; then | ||
echo exclude_graphdriver_btrfs | ||
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
#!/usr/bin/env bash | ||
${CPP:-${CC:-cc} -E} ${CPPFLAGS} - > /dev/null 2> /dev/null << EOF | ||
#include <btrfs/version.h> | ||
EOF | ||
if test $? -ne 0 ; then | ||
echo btrfs_noversion | ||
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
#!/usr/bin/env bash | ||
${CPP:-${CC:-cc} -E} ${CPPFLAGS} - > /dev/null 2> /dev/null << EOF | ||
#include <systemd/sd-daemon.h> | ||
EOF | ||
if test $? -eq 0 ; then | ||
echo systemd | ||
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
package pdcs | ||
|
||
import ( | ||
"context" | ||
"log" | ||
|
||
"github.com/containers/podman/v4/cmd/podman/registry" | ||
"github.com/containers/podman/v4/libpod/events" | ||
"github.com/containers/podman/v4/pkg/domain/entities" | ||
klog "github.com/go-kit/log" | ||
"github.com/go-kit/log/level" | ||
) | ||
|
||
func StartEventStreamer(logger klog.Logger) { | ||
var eventOptions entities.EventsOptions | ||
|
||
level.Debug(logger).Log("msg", "starting podman event streamer") | ||
level.Debug(logger).Log("msg", "update images") | ||
updateImages() | ||
|
||
eventChannel := make(chan *events.Event, 1) | ||
eventOptions.EventChan = eventChannel | ||
eventOptions.Stream = true | ||
eventOptions.Filter = []string{} | ||
errChannel := make(chan error) | ||
|
||
go func() { | ||
err := registry.ContainerEngine().Events(context.Background(), eventOptions) | ||
if err != nil { | ||
errChannel <- err | ||
} | ||
}() | ||
|
||
go func() { | ||
for { | ||
select { | ||
case event, ok := <-eventChannel: | ||
if !ok { | ||
level.Error(logger).Log("msg", "podman received event not ok") | ||
|
||
continue | ||
} | ||
|
||
if event.Type == events.Image { | ||
level.Debug(logger).Log("msg", "update images") | ||
updateImages() | ||
} | ||
case err := <-errChannel: | ||
if err != nil { | ||
log.Fatal(err) | ||
} | ||
} | ||
} | ||
}() | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters