MCPcopy Create free account
hub / github.com/diskfs/go-diskfs / ExampleOpenBackend_backend

Function ExampleOpenBackend_backend

example_test.go:176–190  ·  view source on GitHub ↗

Instantiate the backend manually for later use in diskfs.OpenBackend

()

Source from the content-addressed store, hash-verified

174
175// Instantiate the backend manually for later use in diskfs.OpenBackend
176func ExampleOpenBackend_backend() {
177 // some exemplary fs.FS
178 dirfs := os.DirFS("/tmp/images")
179 // the fs.File we'll use
180 f, err := dirfs.Open("theImage.raw")
181 check(err)
182
183 theBackend := file.New(f, false)
184
185 // As opposed to File example, theBackend will be used as is (i.e. not wrapped).
186 // This usage scenario is for upcoming support for other backends (qcow2 and such).
187 theDisk, err := diskfs.OpenBackend(theBackend)
188 check(err)
189 unused(theDisk)
190}

Callers

nothing calls this directly

Calls 4

NewFunction · 0.92
checkFunction · 0.70
unusedFunction · 0.70
OpenMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…