github.com/lirm/aeron-go@v0.0.0-20230415210743-920325491dc4/cluster/codecs/AdminRequestType.go (about)

     1  // Generated SBE (Simple Binary Encoding) message codec
     2  
     3  package codecs
     4  
     5  import (
     6  	"fmt"
     7  	"io"
     8  	"reflect"
     9  )
    10  
    11  type AdminRequestTypeEnum int32
    12  type AdminRequestTypeValues struct {
    13  	SNAPSHOT  AdminRequestTypeEnum
    14  	NullValue AdminRequestTypeEnum
    15  }
    16  
    17  var AdminRequestType = AdminRequestTypeValues{0, -2147483648}
    18  
    19  func (a AdminRequestTypeEnum) Encode(_m *SbeGoMarshaller, _w io.Writer) error {
    20  	if err := _m.WriteInt32(_w, int32(a)); err != nil {
    21  		return err
    22  	}
    23  	return nil
    24  }
    25  
    26  func (a *AdminRequestTypeEnum) Decode(_m *SbeGoMarshaller, _r io.Reader, actingVersion uint16) error {
    27  	if err := _m.ReadInt32(_r, (*int32)(a)); err != nil {
    28  		return err
    29  	}
    30  	return nil
    31  }
    32  
    33  func (a AdminRequestTypeEnum) RangeCheck(actingVersion uint16, schemaVersion uint16) error {
    34  	if actingVersion > schemaVersion {
    35  		return nil
    36  	}
    37  	value := reflect.ValueOf(AdminRequestType)
    38  	for idx := 0; idx < value.NumField(); idx++ {
    39  		if a == value.Field(idx).Interface() {
    40  			return nil
    41  		}
    42  	}
    43  	return fmt.Errorf("Range check failed on AdminRequestType, unknown enumeration value %d", a)
    44  }
    45  
    46  func (*AdminRequestTypeEnum) EncodedLength() int64 {
    47  	return 4
    48  }
    49  
    50  func (*AdminRequestTypeEnum) SNAPSHOTSinceVersion() uint16 {
    51  	return 0
    52  }
    53  
    54  func (a *AdminRequestTypeEnum) SNAPSHOTInActingVersion(actingVersion uint16) bool {
    55  	return actingVersion >= a.SNAPSHOTSinceVersion()
    56  }
    57  
    58  func (*AdminRequestTypeEnum) SNAPSHOTDeprecated() uint16 {
    59  	return 0
    60  }