GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — fix comments make golint happy · CovenantSQL/CovenantSQL@bd4fe4b

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • cmd/thunderdbd
    • adapter.go
    • bootstrap.go
    • initconf.go
  • consistent
    • persistence.go
  • crypto/kms
    • pubkeystore.go
  • route
    • bootstrap.go
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎cmd/thunderdbd/adapter.go‎

Copy file name to clipboardExpand all lines: cmd/thunderdbd/adapter.go
+14-3Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,9 @@ import (
3333
"gitlab.com/thunderdb/ThunderDB/utils"
3434
)
3535

36-
const CMDSET = "set"
36+
const cmdset = "set"
3737

38+
// LocalStorage holds consistent and storage struct
3839
type LocalStorage struct {
3940
consistent *consistent.Consistent
4041
*storage.Storage
@@ -61,6 +62,7 @@ func initStorage(dbFile string) (stor *LocalStorage, err error) {
6162
return
6263
}
6364

65+
// Prepare implements twopc Worker.Prepare
6466
func (s *LocalStorage) Prepare(ctx context.Context, wb twopc.WriteBatch) (err error) {
6567
payload, err := s.decodeLog(wb)
6668
if err != nil {
@@ -75,6 +77,7 @@ func (s *LocalStorage) Prepare(ctx context.Context, wb twopc.WriteBatch) (err er
7577
return s.Storage.Prepare(ctx, execLog)
7678
}
7779

80+
// Commit implements twopc Worker.Commit
7881
func (s *LocalStorage) Commit(ctx context.Context, wb twopc.WriteBatch) (err error) {
7982

8083
payload, err := s.decodeLog(wb)
@@ -104,6 +107,7 @@ func (s *LocalStorage) Commit(ctx context.Context, wb twopc.WriteBatch) (err err
104107
return s.Storage.Commit(ctx, execLog)
105108
}
106109

110+
// Rollback implements twopc Worker.Rollback
107111
func (s *LocalStorage) Rollback(ctx context.Context, wb twopc.WriteBatch) (err error) {
108112
payload, err := s.decodeLog(wb)
109113
if err != nil {
@@ -121,7 +125,7 @@ func (s *LocalStorage) Rollback(ctx context.Context, wb twopc.WriteBatch) (err e
121125

122126
func (s *LocalStorage) compileExecLog(payload *KayakPayload) (execLog *storage.ExecLog, err error) {
123127
switch payload.Command {
124-
case CMDSET:
128+
case cmdset:
125129
var nodeToSet proto.Node
126130
err = utils.DecodeMsgPack(payload.Data, &nodeToSet)
127131
if err != nil {
@@ -179,28 +183,32 @@ func (s *LocalStorage) decodeLog(wb twopc.WriteBatch) (payload *KayakPayload, er
179183
return
180184
}
181185

186+
// KayakKVServer holds kayak.Runtime and LocalStorage
182187
type KayakKVServer struct {
183188
Runtime *kayak.Runtime
184189
Storage *LocalStorage
185190
}
186191

192+
// Init implements consistent.Persistence
187193
func (s *KayakKVServer) Init(storePath string, initNode *proto.Node) (err error) {
188194
return
189195
}
190196

197+
// KayakPayload is the payload used in kayak Leader and Follower
191198
type KayakPayload struct {
192199
Command string
193200
Data []byte
194201
}
195202

203+
// SetNode implements consistent.Persistence
196204
func (s *KayakKVServer) SetNode(node *proto.Node) (err error) {
197205
nodeBuf, err := utils.EncodeMsgPack(node)
198206
if err != nil {
199207
log.Errorf("marshal node failed: %s", err)
200208
return
201209
}
202210
payload := &KayakPayload{
203-
Command: CMDSET,
211+
Command: cmdset,
204212
Data: nodeBuf.Bytes(),
205213
}
206214

@@ -218,16 +226,19 @@ func (s *KayakKVServer) SetNode(node *proto.Node) (err error) {
218226
return
219227
}
220228

229+
// DelNode implements consistent.Persistence
221230
func (s *KayakKVServer) DelNode(nodeID proto.NodeID) (err error) {
222231
// no need to del node currently
223232
return
224233
}
225234

235+
// Reset implements consistent.Persistence
226236
func (s *KayakKVServer) Reset() (err error) {
227237
// no need to reset for kayak
228238
return
229239
}
230240

241+
// GetAllNodeInfo implements consistent.Persistence
231242
func (s *KayakKVServer) GetAllNodeInfo() (nodes []proto.Node, err error) {
232243
var result [][]interface{}
233244
mh := &codec.MsgpackHandle{}
Collapse file

‎cmd/thunderdbd/bootstrap.go‎

Copy file name to clipboardExpand all lines: cmd/thunderdbd/bootstrap.go
-1Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,6 @@ import (
3535
)
3636

3737
const (
38-
listenHost = "127.0.0.1"
3938
nodeDirPattern = "./node_%v"
4039
pubKeyStoreFile = "public.keystore"
4140
privateKeyFile = "private.key"
Collapse file

‎cmd/thunderdbd/initconf.go‎

Copy file name to clipboardExpand all lines: cmd/thunderdbd/initconf.go
+2Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,8 @@ import (
3131

3232
var (
3333
// TODO(auxten): move these BP info into conf
34+
35+
// AllNodes holds all BP nodes and client node info
3436
AllNodes = []NodeInfo{
3537
{
3638
ID: kms.BPNodeID,
Collapse file

‎consistent/persistence.go‎

Copy file name to clipboardExpand all lines: consistent/persistence.go
+7Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ import (
2222
"gitlab.com/thunderdb/ThunderDB/proto"
2323
)
2424

25+
// Persistence is the interface for consistent persistence
2526
type Persistence interface {
2627
Init(storePath string, initNode *proto.Node) (err error)
2728
SetNode(node *proto.Node) (err error)
@@ -30,24 +31,30 @@ type Persistence interface {
3031
GetAllNodeInfo() (nodes []proto.Node, err error)
3132
}
3233

34+
// KMSStorage implements Persistence
3335
type KMSStorage struct{}
3436

37+
// Init implements Persistence interface
3538
func (s *KMSStorage) Init(storePath string, initNode *proto.Node) (err error) {
3639
return kms.InitPublicKeyStore(storePath, initNode)
3740
}
3841

42+
// SetNode implements Persistence interface
3943
func (s *KMSStorage) SetNode(node *proto.Node) (err error) {
4044
return kms.SetNode(node)
4145
}
4246

47+
// DelNode implements Persistence interface
4348
func (s *KMSStorage) DelNode(nodeID proto.NodeID) (err error) {
4449
return kms.DelNode(nodeID)
4550
}
4651

52+
// Reset implements Persistence interface
4753
func (s *KMSStorage) Reset() (err error) {
4854
return kms.ResetBucket()
4955
}
5056

57+
// GetAllNodeInfo implements Persistence interface
5158
func (s *KMSStorage) GetAllNodeInfo() (nodes []proto.Node, err error) {
5259
IDs, err := kms.GetAllNodeID()
5360
if err != nil {
Collapse file

‎crypto/kms/pubkeystore.go‎

Copy file name to clipboardExpand all lines: crypto/kms/pubkeystore.go
+1Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@ var (
5656

5757
var (
5858
//TODO(auxten): maybe each BP uses distinct key pair is safer
59+
5960
// BPPublicKeyStr is the public key of Block Producer
6061
BPPublicKeyStr = "02c1db96f2ba7e1cb4e9822d12de0f63f" +
6162
"b666feb828c7f509e81fab9bd7a34039c"
Collapse file

‎route/bootstrap.go‎

Copy file name to clipboardExpand all lines: route/bootstrap.go
-7Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,3 @@
1515
*/
1616

1717
package route
18-
19-
import "gitlab.com/thunderdb/ThunderDB/proto"
20-
21-
func GetBootstrapBP() (addrList []proto.Node) {
22-
23-
return
24-
}

0 commit comments

Comments
0 (0)
You are visitor 01402520 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.