Add volume server RPCs to read and update state flags. (#8186)

* Boostrap persistent state for volume servers.

This PR implements logic load/save persistent state information for storages
associated with volume servers, and reporting state changes back to masters
via heartbeat messages.

More work ensues!

See https://github.com/seaweedfs/seaweedfs/issues/7977 for details.

* Add volume server RPCs to read and update state flags.
This commit is contained in:
Lisandro Pin
2026-02-03 01:22:17 +01:00
committed by GitHub
parent 9638d37fe2
commit 345ac950b6
5 changed files with 790 additions and 463 deletions

View File

@@ -69,3 +69,19 @@ func (st *State) Save() error {
glog.V(1).Infof("Saved store state %v to %s", st.Pb, st.FilePath)
return nil
}
func (st *State) Update(state *volume_server_pb.VolumeServerState) error {
if state == nil {
return nil
}
origState := st.Pb
st.Pb = state
err := st.Save()
if err != nil {
// restore the original state upon save failures, to avoid skew between in-memory and disk state protos.
st.Pb = origState
}
return err
}