func (g *retainer) Retain(log lager.Logger, id layercake.ID) { g.retainedImagesMu.Lock() defer g.retainedImagesMu.Unlock() if g.retainedImages == nil { g.retainedImages = make(map[string]struct{}) } g.retainedImages[id.GraphID()] = struct{}{} }
func (g *retainer) Check(id layercake.ID) bool { g.retainedImagesMu.Lock() defer g.retainedImagesMu.Unlock() if g.retainedImages == nil { return false } _, ok := g.retainedImages[id.GraphID()] return ok }
func (a *QuotaedDriver) GetMntPath(id layercake.ID) string { return a.makeMntPath(id.GraphID()) }
Expect(err).NotTo(HaveOccurred()) cake = &layercake.Docker{ Graph: graph, Driver: driver, } }) AfterEach(func() { Expect(syscall.Unmount(root, 0)).To(Succeed()) Expect(os.RemoveAll(root)).To(Succeed()) }) Describe("Register", func() { Context("after registering a layer", func() { var id layercake.ID var parent layercake.ID BeforeEach(func() { id = layercake.ContainerID("") parent = layercake.ContainerID("") }) ItCanReadWriteTheLayer := func() { It("can read and write files", func() { p, err := cake.Path(id) Expect(err).NotTo(HaveOccurred()) Expect(ioutil.WriteFile(path.Join(p, "foo"), []byte("hi"), 0700)).To(Succeed()) p, err = cake.Path(id) Expect(err).NotTo(HaveOccurred())
"code.cloudfoundry.org/garden-shed/layercake/fake_id" "github.com/cloudfoundry/gunk/command_runner" "github.com/cloudfoundry/gunk/command_runner/fake_command_runner" "github.com/cloudfoundry/gunk/command_runner/linux_command_runner" "github.com/docker/docker/image" . "github.com/onsi/ginkgo" . "github.com/onsi/gomega" ) var _ = Describe("Aufs", func() { var ( aufsCake *layercake.AufsCake cake *fake_cake.FakeCake parentID *fake_id.FakeID childID *fake_id.FakeID testError error namespacedChildID layercake.ID otherNamespacedChildID layercake.ID runner command_runner.CommandRunner baseDirectory string ) BeforeEach(func() { var err error baseDirectory, err = ioutil.TempDir("", "aufsTestGraphRoot") Expect(err).NotTo(HaveOccurred()) cake = new(fake_cake.FakeCake) runner = linux_command_runner.New() parentID = new(fake_id.FakeID)