-
Notifications
You must be signed in to change notification settings - Fork 1
/
encoding.go
71 lines (56 loc) · 2.51 KB
/
encoding.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
70
71
/*
* Copyright (C) 2023 Intergral GmbH
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package vparquet
import (
"context"
"io/fs"
"time"
"github.com/google/uuid"
"github.com/intergral/deep/pkg/deepdb/backend"
"github.com/intergral/deep/pkg/deepdb/encoding/common"
)
const VersionString = "vParquet"
type Encoding struct{}
func (v Encoding) Version() string {
return VersionString
}
func (v Encoding) NewCompactor(opts common.CompactionOptions) common.Compactor {
return NewCompactor(opts)
}
func (v Encoding) OpenBlock(meta *backend.BlockMeta, r backend.Reader) (common.BackendBlock, error) {
return newBackendBlock(meta, r), nil
}
func (v Encoding) CopyBlock(ctx context.Context, meta *backend.BlockMeta, from backend.Reader, to backend.Writer) error {
return CopyBlock(ctx, meta, meta, from, to)
}
func (v Encoding) MigrateBlock(ctx context.Context, fromMeta, toMeta *backend.BlockMeta, from backend.Reader, to backend.Writer) error {
return CopyBlock(ctx, fromMeta, toMeta, from, to)
}
func (v Encoding) CreateBlock(ctx context.Context, cfg *common.BlockConfig, meta *backend.BlockMeta, i common.Iterator, r backend.Reader, to backend.Writer) (*backend.BlockMeta, error) {
return CreateBlock(ctx, cfg, meta, i, r, to)
}
// OpenWALBlock opens an existing appendable block
func (v Encoding) OpenWALBlock(filename string, path string, ingestionSlack time.Duration, additionalStartSlack time.Duration) (common.WALBlock, error, error) {
return openWALBlock(filename, path, ingestionSlack, additionalStartSlack)
}
// CreateWALBlock creates a new appendable block
func (v Encoding) CreateWALBlock(id uuid.UUID, tenantID string, filepath string, e backend.Encoding, dataEncoding string, ingestionSlack time.Duration) (common.WALBlock, error) {
return createWALBlock(id, tenantID, filepath, e, dataEncoding, ingestionSlack)
}
func (v Encoding) OwnsWALBlock(entry fs.DirEntry) bool {
return ownsWALBlock(entry)
}