diff options
Diffstat (limited to '')
-rw-r--r-- | verifysetup/cmd/setup.go | 16 | ||||
-rw-r--r-- | verifysetup/core/storage.go | 5 |
2 files changed, 9 insertions, 12 deletions
diff --git a/verifysetup/cmd/setup.go b/verifysetup/cmd/setup.go index 149f41a..81c4dff 100644 --- a/verifysetup/cmd/setup.go +++ b/verifysetup/cmd/setup.go @@ -58,17 +58,6 @@ func checksumBlock(blockStart int, blockEnd int, bundleSize int, diskBytes []byt fmt.Printf("Node from %d to %d finished.\n", blockStart, blockEnd) } -func copyByteArea(start int, end int, reader *bytes.Reader) ([]byte, error) { - bytes := make([]byte, end-start) - n, err := reader.ReadAt(bytes, int64(start)) - if err != nil { - return nil, err - } else if n != end-start { - return nil, fmt.Errorf("Unable to read requested size. Got %d, expected %d", n, end-start) - } - return bytes, nil -} - func SetupCommand(_ *cobra.Command, args []string) error { if len(args) != 2 { return fmt.Errorf("Usage: verifysetup setup [partition] [procCount]") @@ -104,7 +93,7 @@ func SetupCommand(_ *cobra.Command, args []string) error { var waitGroup sync.WaitGroup nodeChannels := make([]chan verify.Node, procCount+1) for i := 0; i < procCount; i++ { - diskBytesCopy, err := copyByteArea(i*(int(bundleSize)), (i+1)*(int(bundleSize)), reader) + diskBytesCopy, err := verify.CopyByteArea(i*(int(bundleSize)), (i+1)*(int(bundleSize)), reader) if err != nil { return err } @@ -141,5 +130,8 @@ func SetupCommand(_ *cobra.Command, args []string) error { return err } fmt.Println(string(signature)) + + //header, err := core. + return nil } diff --git a/verifysetup/core/storage.go b/verifysetup/core/storage.go index 56d32af..48a31d9 100644 --- a/verifysetup/core/storage.go +++ b/verifysetup/core/storage.go @@ -63,3 +63,8 @@ func AddNode(node verify.Node, tx *bolt.Tx) error { } return nil } + +func CreateHeader(unsignedHash string, signedHash string, diskSize int, tableSize int) ([]byte, error) { + header := make([]byte, 200) + +} |