• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

llamerada-jp / colonio / 18451467117

13 Oct 2025 12:12AM UTC coverage: 62.183% (-6.8%) from 68.948%
18451467117

Pull #107

github

llamerada-jp
wip

Signed-off-by: Yuji Ito <llamerada.jp@gmail.com>
Pull Request #107: implement KVS feature

297 of 923 new or added lines in 14 files covered. (32.18%)

5 existing lines in 2 files now uncovered.

3111 of 5003 relevant lines covered (62.18%)

34.5 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

0.0
/internal/kvs/store.go
1
/*
2
 * Copyright 2017- Yuji Ito <llamerada.jp@gmail.com>
3
 *
4
 * Licensed under the Apache License, Version 2.0 (the "License");
5
 * you may not use this file except in compliance with the License.
6
 * You may obtain a copy of the License at
7
 *
8
 *     http://www.apache.org/licenses/LICENSE-2.0
9
 *
10
 * Unless required by applicable law or agreed to in writing, software
11
 * distributed under the License is distributed on an "AS IS" BASIS,
12
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
 * See the License for the specific language governing permissions and
14
 * limitations under the License.
15
 */
16
package kvs
17

18
import (
19
        "sync"
20

21
        proto "github.com/llamerada-jp/colonio/api/colonio/v1alpha"
22
        "github.com/llamerada-jp/colonio/config"
23
        "github.com/llamerada-jp/colonio/internal/shared"
24
)
25

26
type storeHandler interface {
27
        storePropose(command *proto.RaftProposalStore)
28
}
29

30
type storeConfig struct {
31
        sectorKey *config.KvsSectorKey
32
        handler   storeHandler
33
        store     config.KvsStore
34
        head      *shared.NodeID
35
}
36

37
type lock struct {
38
        coordinator uint64
39
        address     *shared.NodeID
40
}
41

42
type store struct {
43
        sectorKey config.KvsSectorKey
44
        handler   storeHandler
45
        mtx       sync.RWMutex
46
        store     config.KvsStore
47
        head      *shared.NodeID
48
        tail      *shared.NodeID
49
        readonly  *lock
50
        blocked   *lock
51
        keys      map[string]any
52
}
53

NEW
54
func newStore(config *storeConfig) *store {
×
NEW
55
        return &store{
×
NEW
56
                sectorKey: *config.sectorKey,
×
NEW
57
                handler:   config.handler,
×
NEW
58
                store:     config.store,
×
NEW
59
                head:      config.head,
×
NEW
60
                keys:      make(map[string]any),
×
NEW
61
        }
×
NEW
62
}
×
63

NEW
64
func (s *store) get(key string) ([]byte, error) {
×
NEW
65
        panic("get not implemented")
×
66
}
67

NEW
68
func (s *store) set(key string, value []byte) error {
×
NEW
69
        panic("set not implemented")
×
70
}
71

NEW
72
func (s *store) patch(key string, value []byte) error {
×
NEW
73
        panic("patch not implemented")
×
74
}
75

NEW
76
func (s *store) delete(key string) error {
×
NEW
77
        panic("delete not implemented")
×
78
}
79

NEW
80
func (s *store) activate(tail *shared.NodeID) {
×
NEW
81
        s.mtx.Lock()
×
NEW
82
        defer s.mtx.Unlock()
×
NEW
83

×
NEW
84
        if s.tail != nil {
×
NEW
85
                panic("logic error: already activated")
×
86
        }
87

NEW
88
        t := *tail
×
NEW
89
        s.tail = &t
×
90
}
91

NEW
92
func (s *store) applyProposal(command *proto.RaftProposalStore) {
×
NEW
93
        panic("apply not implemented")
×
94
}
95

NEW
96
func (s *store) exportRecords(head, tail *shared.NodeID) []byte {
×
NEW
97
        panic("export not implemented")
×
98
}
99

NEW
100
func (s *store) importRecords(data []byte) error {
×
NEW
101
        panic("import not implemented")
×
102
}
103

NEW
104
func (s *store) exportSnapshot() ([]byte, error) {
×
NEW
105
        panic("exportSnapshot not implemented")
×
106
}
107

NEW
108
func (s *store) importSnapshot(data []byte) error {
×
NEW
109
        panic("importSnapshot not implemented")
×
110
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc