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

     1  package cluster
     2  
     3  import (
     4  	"github.com/lirm/aeron-go/aeron/atomic"
     5  	"github.com/lirm/aeron-go/aeron/flyweight"
     6  )
     7  
     8  type MarkFileHeaderFlyweight struct {
     9  	flyweight.FWBase
    10  
    11  	Version           flyweight.Int32Field
    12  	ComponentType     flyweight.Int32Field
    13  	ActivityTimestamp flyweight.Int64Field
    14  	StartTimestamp    flyweight.Int64Field
    15  
    16  	Pid                     flyweight.Int64Field
    17  	CandidateTermId         flyweight.Int64Field
    18  	ArchiveStreamId         flyweight.Int32Field
    19  	ServiceStreamId         flyweight.Int32Field
    20  	ConsensusModuleStreamId flyweight.Int32Field
    21  	IngressStreamId         flyweight.Int32Field
    22  	MemberId                flyweight.Int32Field
    23  	ServiceId               flyweight.Int32Field
    24  
    25  	HeaderLength      flyweight.Int32Field
    26  	ErrorBufferLength flyweight.Int32Field
    27  	ClusterId         flyweight.Int32Field
    28  }
    29  
    30  func (f *MarkFileHeaderFlyweight) Wrap(
    31  	buf *atomic.Buffer,
    32  	offset int,
    33  ) flyweight.Flyweight {
    34  	pos := offset
    35  	pos += f.Version.Wrap(buf, pos)
    36  	pos += f.ComponentType.Wrap(buf, pos)
    37  	pos += f.ActivityTimestamp.Wrap(buf, pos)
    38  	pos += f.StartTimestamp.Wrap(buf, pos)
    39  
    40  	pos += f.Pid.Wrap(buf, pos)
    41  	pos += f.CandidateTermId.Wrap(buf, pos)
    42  	pos += f.ArchiveStreamId.Wrap(buf, pos)
    43  	pos += f.ServiceStreamId.Wrap(buf, pos)
    44  	pos += f.ConsensusModuleStreamId.Wrap(buf, pos)
    45  	pos += f.IngressStreamId.Wrap(buf, pos)
    46  	pos += f.MemberId.Wrap(buf, pos)
    47  	pos += f.ServiceId.Wrap(buf, pos)
    48  
    49  	pos += f.HeaderLength.Wrap(buf, pos)
    50  	pos += f.ErrorBufferLength.Wrap(buf, pos)
    51  	pos += f.ClusterId.Wrap(buf, pos)
    52  
    53  	f.SetSize(HeaderLength + ErrorBufferLength)
    54  	return f
    55  }