-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathvalidator.go
More file actions
35 lines (27 loc) · 707 Bytes
/
Copy pathvalidator.go
File metadata and controls
35 lines (27 loc) · 707 Bytes
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
// Package sentinel defines type interfaces and other code used by sentinel.
package sentinel
import (
"context"
"github.com/ipfs/go-cid"
)
// Validator validates message contents in sentinel. It should be implemented by topic owner.
type Validator interface {
Validate(ctx context.Context, cid cid.Cid) error
}
type ErrorValidationKind uint
const (
ErrorValidationKindUnknown ErrorValidationKind = iota
ErrorValidationKindNotFound
ErrorValidationKindInternal
ErrorValidationKindIncorrectContent
)
type ErrorValidation struct {
Kind ErrorValidationKind
Err error
}
func (e ErrorValidation) Error() string {
return e.Err.Error()
}
func (e ErrorValidation) Unwrap() error {
return e.Err
}