Skip to content

Commit 2fd80ac

Browse files
committed
Merge remote-tracking branch 'origin/develop' into develop
2 parents fa6b0d2 + 1143dd5 commit 2fd80ac

File tree

4 files changed

+46
-46
lines changed

4 files changed

+46
-46
lines changed

internal/app/core/db_manager.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,13 @@ import (
99
)
1010

1111
func InitDb(dbTitle string, storageMode string) (err error) {
12+
globals.LabelTitleMap = make(map[string]globals.MapValue)
13+
globals.RelationshipTitleMap = make(map[string]globals.MapValue)
14+
globals.PropertyTitleMap = make(map[string]globals.MapValue)
1215
if storageMode == "local" {
1316
var fh FileHandler
1417
fh.InitFileSystem()
1518
fh.InitDatabaseStructure(dbTitle)
16-
globals.LabelTitleMap = make(map[string]globals.MapValue)
17-
globals.RelationshipTitleMap = make(map[string]globals.MapValue)
18-
globals.PropertyTitleMap = make(map[string]globals.MapValue)
1919
globals.FileHandler = fh
2020
globals.CurrentDb = dbTitle
2121
return err

internal/app/core/distributed_file_handler.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ func (dfh DistributedFileHandler) InitFileSystem() {
3030
func (dfh DistributedFileHandler) InitDatabaseStructure(dbIdentifier string) {
3131
var fh FileHandler
3232
fh.InitDatabaseStructure(dbIdentifier)
33-
globals.Config.WriteAt([]byte("[\"10.240.22.31:7000\"]"), 0)
33+
globals.Config.WriteAt([]byte("[\"10.91.40.48:7000\"]"), 0)
3434
for i := range master.Slaves {
3535
SendInitDatabaseStructure(&master.Slaves[i], &dbIdentifier)
3636
}

internal/app/core/file_handler.go

Lines changed: 36 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -252,49 +252,49 @@ func (fh FileHandler) DropDatabase(dbTitle string) (err error) {
252252
}
253253

254254
func (fh FileHandler) Read(file *os.File, offset int, bs *[]byte, id int) (err error) {
255-
if strings.HasSuffix(file.Name(), "nodes.store") {
256-
file = globals.NodesStore
257-
}
258-
if strings.HasSuffix(file.Name(), "labels.store") {
259-
file = globals.LabelsStore
260-
}
261-
if strings.HasSuffix(file.Name(), "relationships.store") {
262-
file = globals.RelationshipsStore
263-
}
264-
if strings.HasSuffix(file.Name(), "properties.store") {
265-
file = globals.PropertiesStore
266-
}
267-
if strings.HasSuffix(file.Name(), "string.store") {
268-
file = globals.StringStore
269-
}
270-
if strings.HasSuffix(file.Name(), "double.store") {
271-
file = globals.DoubleStore
272-
}
255+
//if strings.HasSuffix(file.Name(), "nodes.store") {
256+
// file = globals.NodesStore
257+
//}
258+
//if strings.HasSuffix(file.Name(), "labels.store") {
259+
// file = globals.LabelsStore
260+
//}
261+
//if strings.HasSuffix(file.Name(), "relationships.store") {
262+
// file = globals.RelationshipsStore
263+
//}
264+
//if strings.HasSuffix(file.Name(), "properties.store") {
265+
// file = globals.PropertiesStore
266+
//}
267+
//if strings.HasSuffix(file.Name(), "string.store") {
268+
// file = globals.StringStore
269+
//}
270+
//if strings.HasSuffix(file.Name(), "double.store") {
271+
// file = globals.DoubleStore
272+
//}
273273
bytesRead, err := file.ReadAt(*bs, int64(offset))
274274
if bytesRead != len(*bs) {
275275
err = errors.New("read: read less bytes than expected")
276276
}
277277
return err
278278
}
279279
func (fh FileHandler) Write(file *os.File, offset int, bs []byte, id int) (err error) {
280-
if strings.HasSuffix(file.Name(), "nodes.store") {
281-
file = globals.NodesStore
282-
}
283-
if strings.HasSuffix(file.Name(), "labels.store") {
284-
file = globals.LabelsStore
285-
}
286-
if strings.HasSuffix(file.Name(), "relationships.store") {
287-
file = globals.RelationshipsStore
288-
}
289-
if strings.HasSuffix(file.Name(), "properties.store") {
290-
file = globals.PropertiesStore
291-
}
292-
if strings.HasSuffix(file.Name(), "string.store") {
293-
file = globals.StringStore
294-
}
295-
if strings.HasSuffix(file.Name(), "double.store") {
296-
file = globals.DoubleStore
297-
}
280+
//if strings.HasSuffix(file.Name(), "nodes.store") {
281+
// file = globals.NodesStore
282+
//}
283+
//if strings.HasSuffix(file.Name(), "labels.store") {
284+
// file = globals.LabelsStore
285+
//}
286+
//if strings.HasSuffix(file.Name(), "relationships.store") {
287+
// file = globals.RelationshipsStore
288+
//}
289+
//if strings.HasSuffix(file.Name(), "properties.store") {
290+
// file = globals.PropertiesStore
291+
//}
292+
//if strings.HasSuffix(file.Name(), "string.store") {
293+
// file = globals.StringStore
294+
//}
295+
//if strings.HasSuffix(file.Name(), "double.store") {
296+
// file = globals.DoubleStore
297+
//}
298298
bytesWritten, err := file.WriteAt(bs, int64(offset))
299299
if bytesWritten != len(bs) {
300300
err = errors.New("write: wrote less bytes than expected")

internal/app/core/master_node.go

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ func SendReadData(entity *Entity, file *os.File, offset int, id int, bs *[]byte)
4040
request := RPCRequest {requestedData }
4141
err = entity.Connector.Call("Entity.Read", &request, &reply)
4242
if err != nil {
43-
log.Fatal("Error in master_node SendReadData ", err)
43+
log.Panic("Error in master_node SendReadData ", err)
4444
err = errors.New("problems in requestSlaveStatus")
4545
attempts++
4646
continue
@@ -68,7 +68,7 @@ func SendWriteData(entity *Entity, file *os.File, offset int, id int, bs []byte)
6868
request := RPCRequest{ requestedData }
6969
err = entity.Connector.Call("Entity.Write", &request, &reply)
7070
if err != nil {
71-
log.Fatal("Error in master_node SendWriteData ", err)
71+
log.Panic("Error in master_node SendWriteData ", err)
7272
err = errors.New("problems in requestSlaveStatus")
7373
attempts++
7474
continue
@@ -88,7 +88,7 @@ func SendSwitchDatabaseStructure(entity *Entity, newStructure *string) error {
8888
request := RPCRequest{ RequestedData{ Payload: *newStructure } }
8989
err = entity.Connector.Call("Entity.SwitchDatabaseStructure", &request, &reply)
9090
if err != nil {
91-
log.Fatal("Error in master_node SendSwitchDatabaseStructure ", err)
91+
log.Panic("Error in master_node SendSwitchDatabaseStructure ", err)
9292
err = errors.New("problems in requestSlaveStatus")
9393
attempts++
9494
continue
@@ -130,7 +130,7 @@ func SendDeploy(entity *Entity) error {
130130
request := RPCRequest{*new(RequestedData) }
131131
err = entity.Connector.Call("Entity.Deploy", &request, &reply)
132132
if err != nil {
133-
log.Fatal("Error in master_node SendDeploy ", err)
133+
log.Panic("Error in master_node SendDeploy ", err)
134134
err = errors.New("problems in requestSlaveStatus")
135135
attempts++
136136
continue
@@ -152,7 +152,7 @@ func SendInitDatabaseStructure(entity *Entity, dbName *string) error {
152152
request := RPCRequest{ requestedData }
153153
err = entity.Connector.Call("Entity.InitDatabaseStructure", &request, &reply)
154154
if err != nil {
155-
log.Fatal("Error in master_node SendInitDatabaseStructure ", err)
155+
log.Panic("Error in master_node SendInitDatabaseStructure ", err)
156156
err = errors.New("problems in requestSlaveStatus")
157157
attempts++
158158
continue
@@ -172,7 +172,7 @@ func SendDropDatabase(entity *Entity, dbName *string) error {
172172
request := RPCRequest{ RequestedData{ Payload: *dbName } }
173173
err = entity.Connector.Call("Entity.DropDatabase", &request, &reply)
174174
if err != nil {
175-
log.Fatal("Error in master_node SendDropDatabase ", err)
175+
log.Panic("Error in master_node SendDropDatabase ", err)
176176
err = errors.New("problems in requestSlaveStatus")
177177
attempts++
178178
continue

0 commit comments

Comments
 (0)