Skip to content

Commit

Permalink
Export GenerateID and IDLength from overlay2 graphdriver
Browse files Browse the repository at this point in the history
We use this from a2o-migrate to get valid layer IDs

Signed-off-by: Robert Günzler <robertg@balena.io>
  • Loading branch information
robertgzr committed Jan 23, 2020
1 parent 153b030 commit c94a921
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions daemon/graphdriver/overlay2/overlay.go
Expand Up @@ -84,7 +84,7 @@ const (
// The idLength should be selected such that following equation
// is true (512 is a buffer for label metadata).
// ((idLength + len(linkDir) + 1) * maxDepth) <= (pageSize - 512)
idLength = 26
IDLength = 26
)

type overlayOptions struct {
Expand Down Expand Up @@ -431,7 +431,7 @@ func (d *Driver) create(id, parent string, opts *graphdriver.CreateOpts) (retErr
return err
}

lid := generateID(idLength)
lid := GenerateID(IDLength)
if err := os.Symlink(path.Join("..", id, "diff"), path.Join(d.home, linkDir, lid)); err != nil {
return err
}
Expand Down
2 changes: 1 addition & 1 deletion daemon/graphdriver/overlay2/randomid.go
Expand Up @@ -15,7 +15,7 @@ import (
)

// generateID creates a new random string identifier with the given length
func generateID(l int) string {
func GenerateID(l int) string {
const (
// ensures we backoff for less than 450ms total. Use the following to
// select new value, in units of 10ms:
Expand Down

0 comments on commit c94a921

Please sign in to comment.