-
Notifications
You must be signed in to change notification settings - Fork 200
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Node][3/N] Add server to DA Node (#29)
- Loading branch information
Showing
11 changed files
with
386 additions
and
40 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,25 +1,25 @@ | ||
package node | ||
|
||
import ( | ||
import ( | ||
"encoding/binary" | ||
) | ||
|
||
// The interfaces to access the local database, such as leveldb, rocksdb. | ||
type DB interface { | ||
Put(key []byte, value []byte) error | ||
Get(key []byte) ([]byte, error) | ||
Get(key []byte) ([]byte, error) | ||
Delete(key []byte) error | ||
} | ||
|
||
// Converts an uint64 into byte array in big endian. | ||
func ToByteArray(i uint64) []byte { | ||
arr := make([]byte, 8) | ||
binary.BigEndian.PutUint64(arr[0:8], uint64(i)) | ||
return arr | ||
arr := make([]byte, 8) | ||
binary.BigEndian.PutUint64(arr[0:8], uint64(i)) | ||
return arr | ||
} | ||
|
||
// Converts a byte array into an uint64, assuming big endian. | ||
func ToUint64(arr []byte) uint64 { | ||
i := binary.BigEndian.Uint64(arr) | ||
return i | ||
i := binary.BigEndian.Uint64(arr) | ||
return i | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.