-
Notifications
You must be signed in to change notification settings - Fork 1
/
headers.go
69 lines (50 loc) · 2.04 KB
/
headers.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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
/*
Copyright 2017 Continusec Pty Ltd
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
package safeadmin
import (
"errors"
"io"
"time"
"golang.org/x/net/context"
"github.com/continusec/safeadmin/pb"
)
var (
// ErrStorageKeyNotFound returned when object not found in storage
ErrStorageKeyNotFound = errors.New("ErrStorageKeyNotFound")
// ErrInvalidDate returned when the date is a reason why we won't decrypt
ErrInvalidDate = errors.New("ErrInvalidDate")
// ErrInvalidRequest returned when an invalid request is received.
ErrInvalidRequest = errors.New("ErrInvalidRequest")
// ErrInternalError means that an unexpected error occurred.
ErrInternalError = errors.New("ErrInternalError")
// ErrInvalidConfig means the configuration is not supported.
ErrInvalidConfig = errors.New("ErrInvalidConfig")
)
// SafeDumpPersistence is an abstraction for a persistence layer
type SafeDumpPersistence interface {
// Load returns value if found, nil otherwise
Load(ctx context.Context, key []byte) ([]byte, error)
// Save sets value
// The TTL is a suggestion - and is used for the cleanup function
// It should not affect loads.
Save(ctx context.Context, key, value []byte, ttl time.Time) error
// Delete all content with TTL before this time.
Purge(ctx context.Context, now time.Time) error
}
// SafeDumpServiceClient is to combine a Closer with a Server (which is bascially the same as client)
type SafeDumpServiceClient interface {
pb.SafeDumpServiceServer
io.Closer
// SourceName returns the name of the serving we are connected to. Used to key cached certs.
SourceName() string
}