cli: remove unused raft tool helper. (#18954) (#18971)

This commit is contained in:
James Rasell 2023-11-02 08:19:04 +00:00 committed by GitHub
parent 8c4eff2d23
commit a6239adf76
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 0 additions and 30 deletions

View File

@ -27,7 +27,6 @@
"client/structs/...",
"client/taskenv/...",
"command/agent/...",
"command/raft_tools/...",
"command/ui/...",
"helper/...",
"internal/...",

View File

@ -1,29 +0,0 @@
// Copyright (c) HashiCorp, Inc.
// SPDX-License-Identifier: MPL-2.0
package rafttools
import (
"fmt"
raftboltdb "github.com/hashicorp/raft-boltdb/v2"
)
func RaftState(p string) (store *raftboltdb.BoltStore, firstIdx uint64, lastIdx uint64, err error) {
s, err := raftboltdb.NewBoltStore(p)
if err != nil {
return nil, 0, 0, fmt.Errorf("failed to open raft logs: %v", err)
}
firstIdx, err = s.FirstIndex()
if err != nil {
return nil, 0, 0, fmt.Errorf("failed to fetch first index: %v", err)
}
lastIdx, err = s.LastIndex()
if err != nil {
return nil, 0, 0, fmt.Errorf("failed to fetch last index: %v", err)
}
return s, firstIdx, lastIdx, nil
}