-
Notifications
You must be signed in to change notification settings - Fork 294
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Nitish Gupta <imnitish.ng@gmail.com>
- Loading branch information
1 parent
d5f587a
commit 56d8dc0
Showing
6 changed files
with
194 additions
and
9 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,36 @@ | ||
package cache | ||
|
||
import ( | ||
"context" | ||
"os" | ||
|
||
"github.com/docker/docker/client" | ||
) | ||
|
||
type BindCache struct { | ||
docker client.CommonAPIClient | ||
bind string | ||
} | ||
|
||
func NewBindCache(cacheType CacheInfo, dockerClient client.CommonAPIClient) *BindCache { | ||
return &BindCache{ | ||
bind: cacheType.Source, | ||
docker: dockerClient, | ||
} | ||
} | ||
|
||
func (c *BindCache) Name() string { | ||
return c.bind | ||
} | ||
|
||
func (c *BindCache) Clear(ctx context.Context) error { | ||
err := os.RemoveAll(c.bind) | ||
if err != nil { | ||
return err | ||
} | ||
return nil | ||
} | ||
|
||
func (c *BindCache) Type() Type { | ||
return Bind | ||
} |
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 |
---|---|---|
|
@@ -3,6 +3,7 @@ package cache | |
const ( | ||
Image Type = iota | ||
Volume | ||
Bind | ||
) | ||
|
||
type Type int |