Ctrl K
ComunidadGuías…

bldr/desktop/update/update.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/desktop/update/update.proto

package desktop_update

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

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

// UpdateTarget identifies the installed component selected for replacement.
type UpdateTarget int32

const (
	// UPDATE_TARGET_UNKNOWN is invalid for an apply request.
	UpdateTarget_UPDATE_TARGET_UNKNOWN UpdateTarget = 0
	// UPDATE_TARGET_APP selects the installed desktop application.
	UpdateTarget_UPDATE_TARGET_APP UpdateTarget = 1
	// UPDATE_TARGET_DAEMON selects the executing shared daemon.
	UpdateTarget_UPDATE_TARGET_DAEMON UpdateTarget = 2
)

// Enum value maps for UpdateTarget.
var (
	UpdateTarget_name = map[int32]string{
		0: "UPDATE_TARGET_UNKNOWN",
		1: "UPDATE_TARGET_APP",
		2: "UPDATE_TARGET_DAEMON",
	}
	UpdateTarget_value = map[string]int32{
		"UPDATE_TARGET_UNKNOWN": 0,
		"UPDATE_TARGET_APP":     1,
		"UPDATE_TARGET_DAEMON":  2,
	}
)

func (x UpdateTarget) Enum() *UpdateTarget {
	p := new(UpdateTarget)
	*p = x
	return p
}

func (x UpdateTarget) String() string {
	name, valid := UpdateTarget_name[int32(x)]
	if valid {
		return name
	}
	return strconv.Itoa(int(x))
}

// ApplyUpdateRequest selects the installed component to update.
type ApplyUpdateRequest struct {
	unknownFields []byte
	// Target identifies the installed component to update.
	Target UpdateTarget `protobuf:"varint,1,opt,name=target,proto3" json:"target,omitempty"`
}

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

func (*ApplyUpdateRequest) ProtoMessage() {}

func (x *ApplyUpdateRequest) GetTarget() UpdateTarget {
	if x != nil {
		return x.Target
	}
	return UpdateTarget_UPDATE_TARGET_UNKNOWN
}

// ApplyUpdateResponse hands a verified app artifact to its process owner.
type ApplyUpdateResponse struct {
	unknownFields []byte
	// StagedPath is the verified desktop artifact; Electron owns its replacement.
	StagedPath string `protobuf:"bytes,1,opt,name=staged_path,json=stagedPath,proto3" json:"stagedPath,omitempty"`
}

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

func (*ApplyUpdateResponse) ProtoMessage() {}

func (x *ApplyUpdateResponse) GetStagedPath() string {
	if x != nil {
		return x.StagedPath
	}
	return ""
}

func (m *ApplyUpdateRequest) CloneVT() *ApplyUpdateRequest {
	if m == nil {
		return (*ApplyUpdateRequest)(nil)
	}
	r := new(ApplyUpdateRequest)
	r.Target = m.Target
	if len(m.unknownFields) > 0 {
		r.unknownFields = slices.Clone(m.unknownFields)
	}
	return r
}

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

func (m *ApplyUpdateResponse) CloneVT() *ApplyUpdateResponse {
	if m == nil {
		return (*ApplyUpdateResponse)(nil)
	}
	r := new(ApplyUpdateResponse)
	r.StagedPath = m.StagedPath
	if len(m.unknownFields) > 0 {
		r.unknownFields = slices.Clone(m.unknownFields)
	}
	return r
}

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

func (this *ApplyUpdateRequest) EqualVT(that *ApplyUpdateRequest) bool {
	if this == that {
		return true
	} else if this == nil || that == nil {
		return false
	}
	if this.Target != that.Target {
		return false
	}
	return string(this.unknownFields) == string(that.unknownFields)
}

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

func (this *ApplyUpdateResponse) EqualVT(that *ApplyUpdateResponse) bool {
	if this == that {
		return true
	} else if this == nil || that == nil {
		return false
	}
	if this.StagedPath != that.StagedPath {
		return false
	}
	return string(this.unknownFields) == string(that.unknownFields)
}

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

// MarshalProtoJSON marshals the UpdateTarget to JSON.
func (x UpdateTarget) MarshalProtoJSON(s *json.MarshalState) {
	s.WriteEnum(int32(x), UpdateTarget_name)
}

// MarshalText marshals the UpdateTarget to text.
func (x UpdateTarget) MarshalText() ([]byte, error) {
	return []byte(json.GetEnumString(int32(x), UpdateTarget_name)), nil
}

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

// UnmarshalProtoJSON unmarshals the UpdateTarget from JSON.
func (x *UpdateTarget) UnmarshalProtoJSON(s *json.UnmarshalState) {
	v := s.ReadEnum(UpdateTarget_value)
	if err := s.Err(); err != nil {
		s.SetErrorf("could not read UpdateTarget enum: %v", err)
		return
	}
	*x = UpdateTarget(v)
}

// UnmarshalText unmarshals the UpdateTarget from text.
func (x *UpdateTarget) UnmarshalText(b []byte) error {
	i, err := json.ParseEnumString(string(b), UpdateTarget_value)
	if err != nil {
		return err
	}
	*x = UpdateTarget(i)
	return nil
}

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

// MarshalProtoJSON marshals the ApplyUpdateRequest message to JSON.
func (x *ApplyUpdateRequest) MarshalProtoJSON(s *json.MarshalState) {
	if x == nil {
		s.WriteNil()
		return
	}
	s.WriteObjectStart()
	var wroteField bool
	if x.Target != 0 || s.HasField("target") {
		s.WriteMoreIf(&wroteField)
		s.WriteObjectField("target")
		x.Target.MarshalProtoJSON(s)
	}
	s.WriteObjectEnd()
}

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

// UnmarshalProtoJSON unmarshals the ApplyUpdateRequest message from JSON.
func (x *ApplyUpdateRequest) UnmarshalProtoJSON(s *json.UnmarshalState) {
	if s.ReadNil() {
		return
	}
	s.ReadObject(func(key string) {
		switch key {
		default:
			s.Skip() // ignore unknown field
		case "target":
			s.AddField("target")
			x.Target.UnmarshalProtoJSON(s)
		}
	})
}

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

// MarshalProtoJSON marshals the ApplyUpdateResponse message to JSON.
func (x *ApplyUpdateResponse) MarshalProtoJSON(s *json.MarshalState) {
	if x == nil {
		s.WriteNil()
		return
	}
	s.WriteObjectStart()
	var wroteField bool
	if x.StagedPath != "" || s.HasField("stagedPath") {
		s.WriteMoreIf(&wroteField)
		s.WriteObjectField("stagedPath")
		s.WriteString(x.StagedPath)
	}
	s.WriteObjectEnd()
}

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

// UnmarshalProtoJSON unmarshals the ApplyUpdateResponse message from JSON.
func (x *ApplyUpdateResponse) UnmarshalProtoJSON(s *json.UnmarshalState) {
	if s.ReadNil() {
		return
	}
	s.ReadObject(func(key string) {
		switch key {
		default:
			s.Skip() // ignore unknown field
		case "staged_path", "stagedPath":
			s.AddField("staged_path")
			x.StagedPath = s.ReadString()
		}
	})
}

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

func (m *ApplyUpdateRequest) 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 *ApplyUpdateRequest) MarshalToVT(dAtA []byte) (int, error) {
	size := m.SizeVT()
	return m.MarshalToSizedBufferVT(dAtA[:size])
}

func (m *ApplyUpdateRequest) 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.Target != 0 {
		i = protobuf_go_lite.EncodeVarint(dAtA, i, uint64(m.Target))
		i--
		dAtA[i] = 0x8
	}
	return len(dAtA) - i, nil
}

func (m *ApplyUpdateResponse) 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 *ApplyUpdateResponse) MarshalToVT(dAtA []byte) (int, error) {
	size := m.SizeVT()
	return m.MarshalToSizedBufferVT(dAtA[:size])
}

func (m *ApplyUpdateResponse) 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 len(m.StagedPath) > 0 {
		i = protobuf_go_lite.EncodeString(dAtA, i, m.StagedPath)
		i--
		dAtA[i] = 0xa
	}
	return len(dAtA) - i, nil
}

func (m *ApplyUpdateRequest) SizeVT() (n int) {
	if m == nil {
		return 0
	}
	var l int
	_ = l
	n += protobuf_go_lite.SizeVarintNonZero(1, m.Target)
	n += len(m.unknownFields)
	return n
}

func (m *ApplyUpdateResponse) SizeVT() (n int) {
	if m == nil {
		return 0
	}
	var l int
	_ = l
	n += protobuf_go_lite.SizeStringNonEmpty(1, m.StagedPath)
	n += len(m.unknownFields)
	return n
}

func (x UpdateTarget) MarshalProtoText() string {
	return x.String()
}

func (x *ApplyUpdateRequest) MarshalProtoText() string {
	var sb protobuf_go_lite.TextBuilder
	initialLen := protobuf_go_lite.TextStartMessage(&sb, "ApplyUpdateRequest")
	if x.Target != 0 {
		protobuf_go_lite.TextWriteFieldPrefix(&sb, initialLen, "target")
		protobuf_go_lite.TextWriteStringer(&sb, UpdateTarget(x.Target))
	}
	return protobuf_go_lite.TextFinishMessage(&sb)
}

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

func (x *ApplyUpdateResponse) MarshalProtoText() string {
	var sb protobuf_go_lite.TextBuilder
	initialLen := protobuf_go_lite.TextStartMessage(&sb, "ApplyUpdateResponse")
	if x.StagedPath != "" {
		protobuf_go_lite.TextWriteFieldPrefix(&sb, initialLen, "staged_path")
		protobuf_go_lite.TextWriteString(&sb, x.StagedPath)
	}
	return protobuf_go_lite.TextFinishMessage(&sb)
}

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

func (m *ApplyUpdateRequest) 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: ApplyUpdateRequest: wiretype end group for non-group")
		}
		if fieldNum <= 0 {
			return fmt.Errorf("proto: ApplyUpdateRequest: illegal tag %d (wire type %d)", fieldNum, wire)
		}
		switch fieldNum {
		case 1:
			if wireType != 0 {
				return fmt.Errorf("proto: wrong wireType = %d for field Target", wireType)
			}
			m.Target = 0
			var _v uint64
			_v, iNdEx, err = protobuf_go_lite.DecodeVarint(dAtA, iNdEx)
			m.Target = UpdateTarget(_v)
			if err != nil {
				return err
			}
		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
}

func (m *ApplyUpdateResponse) 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: ApplyUpdateResponse: wiretype end group for non-group")
		}
		if fieldNum <= 0 {
			return fmt.Errorf("proto: ApplyUpdateResponse: illegal tag %d (wire type %d)", fieldNum, wire)
		}
		switch fieldNum {
		case 1:
			if wireType != 2 {
				return fmt.Errorf("proto: wrong wireType = %d for field StagedPath", wireType)
			}
			var v string
			v, iNdEx, err = protobuf_go_lite.DecodeString(dAtA, iNdEx)
			if err != nil {
				return err
			}
			m.StagedPath = 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
}