github.com/TrueCloudLab/frostfs-api-go/v2@v2.0.0-20230228134343-196241c4e79a/netmap/string.go (about)

     1  package netmap
     2  
     3  import (
     4  	netmap "github.com/TrueCloudLab/frostfs-api-go/v2/netmap/grpc"
     5  )
     6  
     7  // String returns string representation of Clause.
     8  func (x Clause) String() string {
     9  	return ClauseToGRPCMessage(x).String()
    10  }
    11  
    12  // FromString parses Clause from a string representation.
    13  // It is a reverse action to String().
    14  //
    15  // Returns true if s was parsed successfully.
    16  func (x *Clause) FromString(s string) bool {
    17  	var g netmap.Clause
    18  
    19  	ok := g.FromString(s)
    20  
    21  	if ok {
    22  		*x = ClauseFromGRPCMessage(g)
    23  	}
    24  
    25  	return ok
    26  }
    27  
    28  // String returns string representation of Operation.
    29  func (x Operation) String() string {
    30  	return OperationToGRPCMessage(x).String()
    31  }
    32  
    33  // FromString parses Operation from a string representation.
    34  // It is a reverse action to String().
    35  //
    36  // Returns true if s was parsed successfully.
    37  func (x *Operation) FromString(s string) bool {
    38  	var g netmap.Operation
    39  
    40  	ok := g.FromString(s)
    41  
    42  	if ok {
    43  		*x = OperationFromGRPCMessage(g)
    44  	}
    45  
    46  	return ok
    47  }
    48  
    49  // String returns string representation of NodeState.
    50  func (x NodeState) String() string {
    51  	return NodeStateToGRPCMessage(x).String()
    52  }
    53  
    54  // FromString parses NodeState from a string representation.
    55  // It is a reverse action to String().
    56  //
    57  // Returns true if s was parsed successfully.
    58  func (x *NodeState) FromString(s string) bool {
    59  	var g netmap.NodeInfo_State
    60  
    61  	ok := g.FromString(s)
    62  
    63  	if ok {
    64  		*x = NodeStateFromRPCMessage(g)
    65  	}
    66  
    67  	return ok
    68  }