frostfs-sdk-go/api/netmap/string.go
Evgenii Stratonikov 328d214d2d
[#317] api: Revert easyproto marshaler usage
It has caused a noticeable degradation in node.

Signed-off-by: Evgenii Stratonikov <e.stratonikov@yadro.com>
2025-01-09 11:46:09 +03:00

62 lines
1.4 KiB
Go

package netmap
import (
netmap "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/netmap/grpc"
)
// String returns string representation of Clause.
func (x Clause) String() string {
return ClauseToGRPCMessage(x).String()
}
// FromString parses Clause from a string representation.
// It is a reverse action to String().
//
// Returns true if s was parsed successfully.
func (x *Clause) FromString(s string) bool {
g, ok := netmap.Clause_value[s]
if ok {
*x = ClauseFromGRPCMessage(netmap.Clause(g))
}
return ok
}
// String returns string representation of Operation.
func (x Operation) String() string {
return OperationToGRPCMessage(x).String()
}
// FromString parses Operation from a string representation.
// It is a reverse action to String().
//
// Returns true if s was parsed successfully.
func (x *Operation) FromString(s string) bool {
g, ok := netmap.Operation_value[s]
if ok {
*x = OperationFromGRPCMessage(netmap.Operation(g))
}
return ok
}
// String returns string representation of NodeState.
func (x NodeState) String() string {
return NodeStateToGRPCMessage(x).String()
}
// FromString parses NodeState from a string representation.
// It is a reverse action to String().
//
// Returns true if s was parsed successfully.
func (x *NodeState) FromString(s string) bool {
g, ok := netmap.NodeInfo_State_value[s]
if ok {
*x = NodeStateFromRPCMessage(netmap.NodeInfo_State(g))
}
return ok
}