MCPcopy Create free account
hub / github.com/dgraph-io/dgraph / StoreHardState

Method StoreHardState

raftwal/meta.go:108–119  ·  view source on GitHub ↗
(hs *raftpb.HardState)

Source from the content-addressed store, hash-verified

106}
107
108func (m *metaFile) StoreHardState(hs *raftpb.HardState) error {
109 if hs == nil || raft.IsEmptyHardState(*hs) {
110 return nil
111 }
112 buf, err := hs.Marshal()
113 if err != nil {
114 return errors.Wrapf(err, "cannot marshal hard state")
115 }
116 x.AssertTrue(len(buf) < snapshotIndex-hardStateOffset)
117 writeSlice(m.Data[hardStateOffset:], buf)
118 return nil
119}
120
121func (m *metaFile) HardState() (raftpb.HardState, error) {
122 val := readSlice(m.Data, hardStateOffset)

Callers 2

SaveMethod · 0.80
TestMetaFileFunction · 0.80

Calls 2

AssertTrueFunction · 0.92
writeSliceFunction · 0.85

Tested by 1

TestMetaFileFunction · 0.64