Ctrl K
ComunidadGuías…

bldr/resource/view.pb.go

Rama master · réplica de lectura del repositorio original.

Archivo original ↗Preguntar a KiBot
// Code generated by protoc-gen-go-lite. DO NOT EDIT.
// protoc-gen-go-lite version: v0.19.1-0.20261028131920-f644656fc4a7
// source: github.com/s4wave/spacewave/bldr/resource/view.proto

package resource

import (
	fmt "fmt"
	io "io"
	slices "slices"

	protobuf_go_lite "github.com/aperturerobotics/protobuf-go-lite"
	json "github.com/aperturerobotics/protobuf-go-lite/json"
)

// ViewVersion names the view a feed's message carries. Every versioned view
// message holds it as field 1000, after the view's own fields, so the server
// encodes a view once and appends the version for every stream. A request
// names the version its client holds as string field 1000, held_version.
type ViewVersion struct {
	unknownFields []byte
	// Version names the view's content: equal views share it, across backends
	// and restarts.
	Version string `protobuf:"bytes,1,opt,name=version,proto3" json:"version,omitempty"`
	// Revision is a World revision the view reflects every write up to, so a
	// client that wrote at revision R knows a message at R or later shows it.
	Revision uint64 `protobuf:"varint,2,opt,name=revision,proto3" json:"revision,omitempty"`
	// Unchanged reports that the view is the one the request held, so the
	// message carries no view fields and the client keeps what it holds.
	Unchanged bool `protobuf:"varint,3,opt,name=unchanged,proto3" json:"unchanged,omitempty"`
	// Changes reports that the message carries only the records that changed
	// since the version the stream last delivered, for a watch that asked for
	// changes; the client applies them to the view it holds.
	Changes bool `protobuf:"varint,4,opt,name=changes,proto3" json:"changes,omitempty"`
}

func (x *ViewVersion) Reset() {
	*x = ViewVersion{}
}

func (*ViewVersion) ProtoMessage() {}

func (x *ViewVersion) GetVersion() string {
	if x != nil {
		return x.Version
	}
	return ""
}

func (x *ViewVersion) GetRevision() uint64 {
	if x != nil {
		return x.Revision
	}
	return 0
}

func (x *ViewVersion) GetUnchanged() bool {
	if x != nil {
		return x.Unchanged
	}
	return false
}

func (x *ViewVersion) GetChanges() bool {
	if x != nil {
		return x.Changes
	}
	return false
}

func (m *ViewVersion) CloneVT() *ViewVersion {
	if m == nil {
		return (*ViewVersion)(nil)
	}
	r := new(ViewVersion)
	r.Version = m.Version
	r.Revision = m.Revision
	r.Unchanged = m.Unchanged
	r.Changes = m.Changes
	if len(m.unknownFields) > 0 {
		r.unknownFields = slices.Clone(m.unknownFields)
	}
	return r
}

func (m *ViewVersion) CloneMessageVT() protobuf_go_lite.CloneMessage {
	return m.CloneVT()
}

func (this *ViewVersion) EqualVT(that *ViewVersion) bool {
	if this == that {
		return true
	} else if this == nil || that == nil {
		return false
	}
	if this.Version != that.Version {
		return false
	}
	if this.Revision != that.Revision {
		return false
	}
	if this.Unchanged != that.Unchanged {
		return false
	}
	if this.Changes != that.Changes {
		return false
	}
	return string(this.unknownFields) == string(that.unknownFields)
}

func (this *ViewVersion) EqualMessageVT(thatMsg any) bool {
	that, ok := thatMsg.(*ViewVersion)
	if !ok {
		return false
	}
	return this.EqualVT(that)
}

// MarshalProtoJSON marshals the ViewVersion message to JSON.
func (x *ViewVersion) MarshalProtoJSON(s *json.MarshalState) {
	if x == nil {
		s.WriteNil()
		return
	}
	s.WriteObjectStart()
	var wroteField bool
	if x.Version != "" || s.HasField("version") {
		s.WriteMoreIf(&wroteField)
		s.WriteObjectField("version")
		s.WriteString(x.Version)
	}
	if x.Revision != 0 || s.HasField("revision") {
		s.WriteMoreIf(&wroteField)
		s.WriteObjectField("revision")
		s.WriteUint64(x.Revision)
	}
	if x.Unchanged || s.HasField("unchanged") {
		s.WriteMoreIf(&wroteField)
		s.WriteObjectField("unchanged")
		s.WriteBool(x.Unchanged)
	}
	if x.Changes || s.HasField("changes") {
		s.WriteMoreIf(&wroteField)
		s.WriteObjectField("changes")
		s.WriteBool(x.Changes)
	}
	s.WriteObjectEnd()
}

// MarshalJSON marshals the ViewVersion to JSON.
func (x *ViewVersion) MarshalJSON() ([]byte, error) {
	return json.DefaultMarshalerConfig.Marshal(x)
}

// UnmarshalProtoJSON unmarshals the ViewVersion message from JSON.
func (x *ViewVersion) UnmarshalProtoJSON(s *json.UnmarshalState) {
	if s.ReadNil() {
		return
	}
	s.ReadObject(func(key string) {
		switch key {
		default:
			s.Skip() // ignore unknown field
		case "version":
			s.AddField("version")
			x.Version = s.ReadString()
		case "revision":
			s.AddField("revision")
			x.Revision = s.ReadUint64()
		case "unchanged":
			s.AddField("unchanged")
			x.Unchanged = s.ReadBool()
		case "changes":
			s.AddField("changes")
			x.Changes = s.ReadBool()
		}
	})
}

// UnmarshalJSON unmarshals the ViewVersion from JSON.
func (x *ViewVersion) UnmarshalJSON(b []byte) error {
	return json.DefaultUnmarshalerConfig.Unmarshal(b, x)
}

func (m *ViewVersion) MarshalVT() (dAtA []byte, err error) {
	if m == nil {
		return nil, nil
	}
	size := m.SizeVT()
	dAtA = make([]byte, size)
	n, err := m.MarshalToSizedBufferVT(dAtA[:size])
	if err != nil {
		return nil, err
	}
	return dAtA[:n], nil
}

func (m *ViewVersion) MarshalToVT(dAtA []byte) (int, error) {
	size := m.SizeVT()
	return m.MarshalToSizedBufferVT(dAtA[:size])
}

func (m *ViewVersion) MarshalToSizedBufferVT(dAtA []byte) (int, error) {
	if m == nil {
		return 0, nil
	}
	i := len(dAtA)
	_ = i
	var l int
	_ = l
	if m.unknownFields != nil {
		i = protobuf_go_lite.EncodeRawBytes(dAtA, i, m.unknownFields)
	}
	if m.Changes {
		i = protobuf_go_lite.EncodeBool(dAtA, i, m.Changes)
		i--
		dAtA[i] = 0x20
	}
	if m.Unchanged {
		i = protobuf_go_lite.EncodeBool(dAtA, i, m.Unchanged)
		i--
		dAtA[i] = 0x18
	}
	if m.Revision != 0 {
		i = protobuf_go_lite.EncodeVarint(dAtA, i, uint64(m.Revision))
		i--
		dAtA[i] = 0x10
	}
	if len(m.Version) > 0 {
		i = protobuf_go_lite.EncodeString(dAtA, i, m.Version)
		i--
		dAtA[i] = 0xa
	}
	return len(dAtA) - i, nil
}

func (m *ViewVersion) SizeVT() (n int) {
	if m == nil {
		return 0
	}
	var l int
	_ = l
	n += protobuf_go_lite.SizeStringNonEmpty(1, m.Version)
	n += protobuf_go_lite.SizeVarintNonZero(1, m.Revision)
	n += protobuf_go_lite.SizeBoolNonZero(1, m.Unchanged)
	n += protobuf_go_lite.SizeBoolNonZero(1, m.Changes)
	n += len(m.unknownFields)
	return n
}

func (x *ViewVersion) MarshalProtoText() string {
	var sb protobuf_go_lite.TextBuilder
	initialLen := protobuf_go_lite.TextStartMessage(&sb, "ViewVersion")
	if x.Version != "" {
		protobuf_go_lite.TextWriteFieldPrefix(&sb, initialLen, "version")
		protobuf_go_lite.TextWriteString(&sb, x.Version)
	}
	if x.Revision != 0 {
		protobuf_go_lite.TextWriteFieldPrefix(&sb, initialLen, "revision")
		protobuf_go_lite.TextWriteUint(&sb, x.Revision)
	}
	if x.Unchanged != false {
		protobuf_go_lite.TextWriteFieldPrefix(&sb, initialLen, "unchanged")
		protobuf_go_lite.TextWriteBool(&sb, x.Unchanged)
	}
	if x.Changes != false {
		protobuf_go_lite.TextWriteFieldPrefix(&sb, initialLen, "changes")
		protobuf_go_lite.TextWriteBool(&sb, x.Changes)
	}
	return protobuf_go_lite.TextFinishMessage(&sb)
}

func (x *ViewVersion) String() string {
	return x.MarshalProtoText()
}

func (m *ViewVersion) UnmarshalVT(dAtA []byte) error {
	l := len(dAtA)
	iNdEx := 0
	var err error
	for iNdEx < l {
		preIndex := iNdEx
		var wire uint64
		wire, iNdEx, err = protobuf_go_lite.DecodeVarint(dAtA, iNdEx)
		if err != nil {
			return err
		}
		fieldNum := int32(wire >> 3)
		wireType := int(wire & 0x7)
		if wireType == 4 {
			return fmt.Errorf("proto: ViewVersion: wiretype end group for non-group")
		}
		if fieldNum <= 0 {
			return fmt.Errorf("proto: ViewVersion: illegal tag %d (wire type %d)", fieldNum, wire)
		}
		switch fieldNum {
		case 1:
			if wireType != 2 {
				return fmt.Errorf("proto: wrong wireType = %d for field Version", wireType)
			}
			var v string
			v, iNdEx, err = protobuf_go_lite.DecodeString(dAtA, iNdEx)
			if err != nil {
				return err
			}
			m.Version = v
		case 2:
			if wireType != 0 {
				return fmt.Errorf("proto: wrong wireType = %d for field Revision", wireType)
			}
			m.Revision = 0
			m.Revision, iNdEx, err = protobuf_go_lite.DecodeVarint(dAtA, iNdEx)
			if err != nil {
				return err
			}
		case 3:
			if wireType != 0 {
				return fmt.Errorf("proto: wrong wireType = %d for field Unchanged", wireType)
			}
			var v bool
			v, iNdEx, err = protobuf_go_lite.DecodeVarintBool(dAtA, iNdEx)
			if err != nil {
				return err
			}
			m.Unchanged = bool(v)
		case 4:
			if wireType != 0 {
				return fmt.Errorf("proto: wrong wireType = %d for field Changes", wireType)
			}
			var v bool
			v, iNdEx, err = protobuf_go_lite.DecodeVarintBool(dAtA, iNdEx)
			if err != nil {
				return err
			}
			m.Changes = bool(v)
		default:
			iNdEx = preIndex
			skippy, err := protobuf_go_lite.Skip(dAtA[iNdEx:])
			if err != nil {
				return err
			}
			if (skippy < 0) || (iNdEx+skippy) < 0 {
				return protobuf_go_lite.ErrInvalidLength
			}
			if (iNdEx + skippy) > l {
				return io.ErrUnexpectedEOF
			}
			m.unknownFields = append(m.unknownFields, dAtA[iNdEx:iNdEx+skippy]...)
			iNdEx += skippy
		}
	}

	if iNdEx > l {
		return io.ErrUnexpectedEOF
	}
	return nil
}