MCPcopy
hub / github.com/dgraph-io/dgraph / UriHandler

Interface UriHandler

worker/backup_handler.go:84–106  ·  view source on GitHub ↗

UriHandler interface is implemented by URI scheme handlers. When adding new scheme handles, for example 'azure://', an object will implement this interface to supply Dgraph with a way to create or load backup files into DB. For all methods below, the URL object is parsed as described in `newHandler'

Source from the content-addressed store, hash-verified

82// For all methods below, the URL object is parsed as described in `newHandler' and
83// the Processor object has the DB, estimated tablets size, and backup parameters.
84type UriHandler interface {
85 // CreateDir creates a directory relative to the root path of the handler.
86 CreateDir(path string) error
87 // CreateFile creates a file relative to the root path of the handler. It also makes the
88 // handler's descriptor to point to this file.
89 CreateFile(path string) (io.WriteCloser, error)
90 // DirExists returns true if the directory relative to the root path of the handler exists.
91 DirExists(path string) bool
92 // FileExists returns true if the file relative to the root path of the handler exists.
93 FileExists(path string) bool
94 // JoinPath appends the given path to the root path of the handler.
95 JoinPath(path string) string
96 // ListPaths returns a list of all the valid paths from the given root path. The given root path
97 // should be relative to the handler's root path.
98 ListPaths(path string) []string
99 // Read reads the file at given relative path and returns the read bytes.
100 Read(path string) ([]byte, error)
101 // Rename renames the src file to the destination file.
102 Rename(src, dst string) error
103 // Stream would stream the path via an instance of io.ReadCloser. Close must be called at the
104 // end to release resources appropriately.
105 Stream(path string) (io.ReadCloser, error)
106}
107
108// NewUriHandler parses the requested URI and finds the corresponding UriHandler.
109// If the passed credentials are not nil, they will be used to override the

Callers 25

ProcessBackupRequestFunction · 0.95
createBackupFileFunction · 0.65
CreateManifestFunction · 0.65
CreateManifestSummaryFunction · 0.65
createBackupFileFunction · 0.65
ProcessBackupRequestFunction · 0.95
GetManifestNoUpgradeFunction · 0.65
ListBackupManifestsFunction · 0.95
getManifestsToRestoreFunction · 0.65
getConsolidatedManifestFunction · 0.65

Implementers 2

fileHandlerworker/backup_handler.go
s3Handlerworker/backup_handler.go

Calls

no outgoing calls

Tested by

no test coverage detected