fix: prunepolicy.max_unused_percent should allow decimal values

This commit is contained in:
garethgeorge
2024-09-16 21:34:22 -07:00
parent d59c6fc1be
commit 3056203127
3 changed files with 14 additions and 14 deletions
+6 -6
View File
@@ -886,8 +886,8 @@ type PrunePolicy struct {
unknownFields protoimpl.UnknownFields
Schedule *Schedule `protobuf:"bytes,2,opt,name=schedule,proto3" json:"schedule,omitempty"`
MaxUnusedBytes int32 `protobuf:"varint,3,opt,name=max_unused_bytes,json=maxUnusedBytes,proto3" json:"max_unused_bytes,omitempty"` // max unused bytes before running prune.
MaxUnusedPercent int32 `protobuf:"varint,4,opt,name=max_unused_percent,json=maxUnusedPercent,proto3" json:"max_unused_percent,omitempty"` // max unused percent before running prune.
MaxUnusedBytes int64 `protobuf:"varint,3,opt,name=max_unused_bytes,json=maxUnusedBytes,proto3" json:"max_unused_bytes,omitempty"` // max unused bytes before running prune.
MaxUnusedPercent float64 `protobuf:"fixed64,4,opt,name=max_unused_percent,json=maxUnusedPercent,proto3" json:"max_unused_percent,omitempty"` // max unused percent before running prune.
}
func (x *PrunePolicy) Reset() {
@@ -929,14 +929,14 @@ func (x *PrunePolicy) GetSchedule() *Schedule {
return nil
}
func (x *PrunePolicy) GetMaxUnusedBytes() int32 {
func (x *PrunePolicy) GetMaxUnusedBytes() int64 {
if x != nil {
return x.MaxUnusedBytes
}
return 0
}
func (x *PrunePolicy) GetMaxUnusedPercent() int32 {
func (x *PrunePolicy) GetMaxUnusedPercent() float64 {
if x != nil {
return x.MaxUnusedPercent
}
@@ -2021,10 +2021,10 @@ var file_v1_config_proto_rawDesc = []byte{
0x6c, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0c, 0x2e, 0x76, 0x31, 0x2e, 0x53, 0x63,
0x68, 0x65, 0x64, 0x75, 0x6c, 0x65, 0x52, 0x08, 0x73, 0x63, 0x68, 0x65, 0x64, 0x75, 0x6c, 0x65,
0x12, 0x28, 0x0a, 0x10, 0x6d, 0x61, 0x78, 0x5f, 0x75, 0x6e, 0x75, 0x73, 0x65, 0x64, 0x5f, 0x62,
0x79, 0x74, 0x65, 0x73, 0x18, 0x03, 0x20, 0x01, 0x28, 0x05, 0x52, 0x0e, 0x6d, 0x61, 0x78, 0x55,
0x79, 0x74, 0x65, 0x73, 0x18, 0x03, 0x20, 0x01, 0x28, 0x03, 0x52, 0x0e, 0x6d, 0x61, 0x78, 0x55,
0x6e, 0x75, 0x73, 0x65, 0x64, 0x42, 0x79, 0x74, 0x65, 0x73, 0x12, 0x2c, 0x0a, 0x12, 0x6d, 0x61,
0x78, 0x5f, 0x75, 0x6e, 0x75, 0x73, 0x65, 0x64, 0x5f, 0x70, 0x65, 0x72, 0x63, 0x65, 0x6e, 0x74,
0x18, 0x04, 0x20, 0x01, 0x28, 0x05, 0x52, 0x10, 0x6d, 0x61, 0x78, 0x55, 0x6e, 0x75, 0x73, 0x65,
0x18, 0x04, 0x20, 0x01, 0x28, 0x01, 0x52, 0x10, 0x6d, 0x61, 0x78, 0x55, 0x6e, 0x75, 0x73, 0x65,
0x64, 0x50, 0x65, 0x72, 0x63, 0x65, 0x6e, 0x74, 0x22, 0xa3, 0x01, 0x0a, 0x0b, 0x43, 0x68, 0x65,
0x63, 0x6b, 0x50, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x12, 0x28, 0x0a, 0x08, 0x73, 0x63, 0x68, 0x65,
0x64, 0x75, 0x6c, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0c, 0x2e, 0x76, 0x31, 0x2e,
+2 -2
View File
@@ -92,8 +92,8 @@ message RetentionPolicy {
message PrunePolicy {
Schedule schedule = 2 [json_name="schedule"];
int32 max_unused_bytes = 3 [json_name="maxUnusedBytes"]; // max unused bytes before running prune.
int32 max_unused_percent = 4 [json_name="maxUnusedPercent"]; // max unused percent before running prune.
int64 max_unused_bytes = 3 [json_name="maxUnusedBytes"]; // max unused bytes before running prune.
double max_unused_percent = 4 [json_name="maxUnusedPercent"]; // max unused percent before running prune.
}
message CheckPolicy {
+6 -6
View File
@@ -4,7 +4,7 @@
// @ts-nocheck
import type { BinaryReadOptions, FieldList, JsonReadOptions, JsonValue, PartialMessage, PlainMessage } from "@bufbuild/protobuf";
import { Message, proto3 } from "@bufbuild/protobuf";
import { Message, proto3, protoInt64 } from "@bufbuild/protobuf";
/**
* @generated from message v1.HubConfig
@@ -623,14 +623,14 @@ export class PrunePolicy extends Message<PrunePolicy> {
/**
* max unused bytes before running prune.
*
* @generated from field: int32 max_unused_bytes = 3;
* @generated from field: int64 max_unused_bytes = 3;
*/
maxUnusedBytes = 0;
maxUnusedBytes = protoInt64.zero;
/**
* max unused percent before running prune.
*
* @generated from field: int32 max_unused_percent = 4;
* @generated from field: double max_unused_percent = 4;
*/
maxUnusedPercent = 0;
@@ -643,8 +643,8 @@ export class PrunePolicy extends Message<PrunePolicy> {
static readonly typeName = "v1.PrunePolicy";
static readonly fields: FieldList = proto3.util.newFieldList(() => [
{ no: 2, name: "schedule", kind: "message", T: Schedule },
{ no: 3, name: "max_unused_bytes", kind: "scalar", T: 5 /* ScalarType.INT32 */ },
{ no: 4, name: "max_unused_percent", kind: "scalar", T: 5 /* ScalarType.INT32 */ },
{ no: 3, name: "max_unused_bytes", kind: "scalar", T: 3 /* ScalarType.INT64 */ },
{ no: 4, name: "max_unused_percent", kind: "scalar", T: 1 /* ScalarType.DOUBLE */ },
]);
static fromBinary(bytes: Uint8Array, options?: Partial<BinaryReadOptions>): PrunePolicy {