forked from pachyderm/pachyderm
/
pfs.go
51 lines (40 loc) · 1.06 KB
/
pfs.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
package pfs
import (
"fmt"
"github.com/pachyderm/pachyderm/src/client/pfs"
)
type ErrFileNotFound struct {
error
}
type ErrRepoNotFound struct {
error
}
type ErrCommitNotFound struct {
error
}
type ErrParentCommitNotFound struct {
error
}
func NewErrFileNotFound(file string, repo string, commitID string) *ErrFileNotFound {
return &ErrFileNotFound{
error: fmt.Errorf("File %v not found in repo %v at commit %v", file, repo, commitID),
}
}
func NewErrRepoNotFound(repo string) *ErrRepoNotFound {
return &ErrRepoNotFound{
error: fmt.Errorf("Repo %v not found", repo),
}
}
func NewErrCommitNotFound(repo string, commitID string) *ErrCommitNotFound {
return &ErrCommitNotFound{
error: fmt.Errorf("Commit %v not found in repo %v", commitID, repo),
}
}
func NewErrParentCommitNotFound(repo string, commitID string) *ErrParentCommitNotFound {
return &ErrParentCommitNotFound{
error: fmt.Errorf("Parent commit %v not found in repo %v", commitID, repo),
}
}
func ByteRangeSize(byteRange *pfs.ByteRange) uint64 {
return byteRange.Upper - byteRange.Lower
}