mirror of
https://github.com/garethgeorge/backrest.git
synced 2026-08-27 03:16:29 +00:00
feat: improve oplist performance and display forget operations in oplist (#22)
This commit is contained in:
@@ -31,6 +31,12 @@ jobs:
|
||||
- name: Install Deps
|
||||
run: ./scripts/install-deps.sh
|
||||
|
||||
- name: Login to Docker Hub
|
||||
uses: docker/login-action@v3
|
||||
with:
|
||||
username: ${{ secrets.DOCKERHUB_USERNAME }}
|
||||
password: ${{ secrets.DOCKERHUB_TOKEN }}
|
||||
|
||||
- name: Run GoReleaser
|
||||
uses: goreleaser/goreleaser-action@v5
|
||||
with:
|
||||
@@ -40,12 +46,6 @@ jobs:
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
||||
- name: Login to Docker Hub
|
||||
uses: docker/login-action@v3
|
||||
with:
|
||||
username: ${{ secrets.DOCKERHUB_USERNAME }}
|
||||
password: ${{ secrets.DOCKERHUB_TOKEN }}
|
||||
|
||||
- name: Upload Artifacts
|
||||
uses: actions/upload-artifact@v3
|
||||
with:
|
||||
|
||||
@@ -0,0 +1,16 @@
|
||||
# Changelog
|
||||
|
||||
## [0.2.0](https://github.com/garethgeorge/resticweb/compare/v0.1.3...v0.2.0) (2023-12-02)
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* forget soft-deletes operations associated with removed snapshots ([f3dc7ff](https://github.com/garethgeorge/resticweb/commit/f3dc7ffd077fef67870852f8f4e8b9aa6c94806e))
|
||||
* forget soft-deletes operations associated with removed snapshots ([38bc107](https://github.com/garethgeorge/resticweb/commit/38bc107db394716e34245f1edefc5e4cf4a15333))
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* forget deadlocking and misc smaller bugs ([b7c633d](https://github.com/garethgeorge/resticweb/commit/b7c633d021d68d4880a5f442ce70a858002b4af2))
|
||||
* improve operation ordering to fix snapshots indexed before forget operation ([#21](https://github.com/garethgeorge/resticweb/issues/21)) ([b513b08](https://github.com/garethgeorge/resticweb/commit/b513b08e51434c28c90f5f062b4ae292f6854f4e))
|
||||
* task priority not taking effect ([af7462c](https://github.com/garethgeorge/resticweb/commit/af7462cefb130153cdaaa08e8ebefefa40e80e49))
|
||||
+107
-92
@@ -532,6 +532,7 @@ type OperationForget struct {
|
||||
unknownFields protoimpl.UnknownFields
|
||||
|
||||
Forget []*ResticSnapshot `protobuf:"bytes,1,rep,name=forget,proto3" json:"forget,omitempty"`
|
||||
Policy *RetentionPolicy `protobuf:"bytes,2,opt,name=policy,proto3" json:"policy,omitempty"`
|
||||
}
|
||||
|
||||
func (x *OperationForget) Reset() {
|
||||
@@ -573,6 +574,13 @@ func (x *OperationForget) GetForget() []*ResticSnapshot {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (x *OperationForget) GetPolicy() *RetentionPolicy {
|
||||
if x != nil {
|
||||
return x.Policy
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// OperationPrune tracks a prune operation.
|
||||
type OperationPrune struct {
|
||||
state protoimpl.MessageState
|
||||
@@ -626,93 +634,97 @@ var File_v1_operations_proto protoreflect.FileDescriptor
|
||||
var file_v1_operations_proto_rawDesc = []byte{
|
||||
0x0a, 0x13, 0x76, 0x31, 0x2f, 0x6f, 0x70, 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e,
|
||||
0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x02, 0x76, 0x31, 0x1a, 0x0f, 0x76, 0x31, 0x2f, 0x72, 0x65,
|
||||
0x73, 0x74, 0x69, 0x63, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x3e, 0x0a, 0x0d, 0x4f, 0x70,
|
||||
0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x4c, 0x69, 0x73, 0x74, 0x12, 0x2d, 0x0a, 0x0a, 0x6f,
|
||||
0x70, 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32,
|
||||
0x0d, 0x2e, 0x76, 0x31, 0x2e, 0x4f, 0x70, 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x0a,
|
||||
0x6f, 0x70, 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x22, 0xbb, 0x04, 0x0a, 0x09, 0x4f,
|
||||
0x70, 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01,
|
||||
0x20, 0x01, 0x28, 0x03, 0x52, 0x02, 0x69, 0x64, 0x12, 0x17, 0x0a, 0x07, 0x72, 0x65, 0x70, 0x6f,
|
||||
0x5f, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x72, 0x65, 0x70, 0x6f, 0x49,
|
||||
0x64, 0x12, 0x17, 0x0a, 0x07, 0x70, 0x6c, 0x61, 0x6e, 0x5f, 0x69, 0x64, 0x18, 0x03, 0x20, 0x01,
|
||||
0x28, 0x09, 0x52, 0x06, 0x70, 0x6c, 0x61, 0x6e, 0x49, 0x64, 0x12, 0x1f, 0x0a, 0x0b, 0x73, 0x6e,
|
||||
0x61, 0x70, 0x73, 0x68, 0x6f, 0x74, 0x5f, 0x69, 0x64, 0x18, 0x08, 0x20, 0x01, 0x28, 0x09, 0x52,
|
||||
0x0a, 0x73, 0x6e, 0x61, 0x70, 0x73, 0x68, 0x6f, 0x74, 0x49, 0x64, 0x12, 0x2b, 0x0a, 0x06, 0x73,
|
||||
0x74, 0x61, 0x74, 0x75, 0x73, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x13, 0x2e, 0x76, 0x31,
|
||||
0x2e, 0x4f, 0x70, 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73,
|
||||
0x52, 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x2b, 0x0a, 0x12, 0x75, 0x6e, 0x69, 0x78,
|
||||
0x5f, 0x74, 0x69, 0x6d, 0x65, 0x5f, 0x73, 0x74, 0x61, 0x72, 0x74, 0x5f, 0x6d, 0x73, 0x18, 0x05,
|
||||
0x20, 0x01, 0x28, 0x03, 0x52, 0x0f, 0x75, 0x6e, 0x69, 0x78, 0x54, 0x69, 0x6d, 0x65, 0x53, 0x74,
|
||||
0x61, 0x72, 0x74, 0x4d, 0x73, 0x12, 0x27, 0x0a, 0x10, 0x75, 0x6e, 0x69, 0x78, 0x5f, 0x74, 0x69,
|
||||
0x6d, 0x65, 0x5f, 0x65, 0x6e, 0x64, 0x5f, 0x6d, 0x73, 0x18, 0x06, 0x20, 0x01, 0x28, 0x03, 0x52,
|
||||
0x0d, 0x75, 0x6e, 0x69, 0x78, 0x54, 0x69, 0x6d, 0x65, 0x45, 0x6e, 0x64, 0x4d, 0x73, 0x12, 0x27,
|
||||
0x0a, 0x0f, 0x64, 0x69, 0x73, 0x70, 0x6c, 0x61, 0x79, 0x5f, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67,
|
||||
0x65, 0x18, 0x07, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0e, 0x64, 0x69, 0x73, 0x70, 0x6c, 0x61, 0x79,
|
||||
0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x12, 0x40, 0x0a, 0x10, 0x6f, 0x70, 0x65, 0x72, 0x61,
|
||||
0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x62, 0x61, 0x63, 0x6b, 0x75, 0x70, 0x18, 0x64, 0x20, 0x01, 0x28,
|
||||
0x0b, 0x32, 0x13, 0x2e, 0x76, 0x31, 0x2e, 0x4f, 0x70, 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e,
|
||||
0x42, 0x61, 0x63, 0x6b, 0x75, 0x70, 0x48, 0x00, 0x52, 0x0f, 0x6f, 0x70, 0x65, 0x72, 0x61, 0x74,
|
||||
0x69, 0x6f, 0x6e, 0x42, 0x61, 0x63, 0x6b, 0x75, 0x70, 0x12, 0x56, 0x0a, 0x18, 0x6f, 0x70, 0x65,
|
||||
0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x69, 0x6e, 0x64, 0x65, 0x78, 0x5f, 0x73, 0x6e, 0x61,
|
||||
0x70, 0x73, 0x68, 0x6f, 0x74, 0x18, 0x65, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x76, 0x31,
|
||||
0x2e, 0x4f, 0x70, 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x49, 0x6e, 0x64, 0x65, 0x78, 0x53,
|
||||
0x6e, 0x61, 0x70, 0x73, 0x68, 0x6f, 0x74, 0x48, 0x00, 0x52, 0x16, 0x6f, 0x70, 0x65, 0x72, 0x61,
|
||||
0x74, 0x69, 0x6f, 0x6e, 0x49, 0x6e, 0x64, 0x65, 0x78, 0x53, 0x6e, 0x61, 0x70, 0x73, 0x68, 0x6f,
|
||||
0x74, 0x12, 0x40, 0x0a, 0x10, 0x6f, 0x70, 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x66,
|
||||
0x6f, 0x72, 0x67, 0x65, 0x74, 0x18, 0x66, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x13, 0x2e, 0x76, 0x31,
|
||||
0x2e, 0x4f, 0x70, 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x46, 0x6f, 0x72, 0x67, 0x65, 0x74,
|
||||
0x48, 0x00, 0x52, 0x0f, 0x6f, 0x70, 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x46, 0x6f, 0x72,
|
||||
0x67, 0x65, 0x74, 0x12, 0x3d, 0x0a, 0x0f, 0x6f, 0x70, 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e,
|
||||
0x5f, 0x70, 0x72, 0x75, 0x6e, 0x65, 0x18, 0x67, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x12, 0x2e, 0x76,
|
||||
0x31, 0x2e, 0x4f, 0x70, 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x50, 0x72, 0x75, 0x6e, 0x65,
|
||||
0x48, 0x00, 0x52, 0x0e, 0x6f, 0x70, 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x50, 0x72, 0x75,
|
||||
0x6e, 0x65, 0x42, 0x04, 0x0a, 0x02, 0x6f, 0x70, 0x22, 0x69, 0x0a, 0x0e, 0x4f, 0x70, 0x65, 0x72,
|
||||
0x61, 0x74, 0x69, 0x6f, 0x6e, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x12, 0x2a, 0x0a, 0x04, 0x74, 0x79,
|
||||
0x70, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x16, 0x2e, 0x76, 0x31, 0x2e, 0x4f, 0x70,
|
||||
0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x54, 0x79, 0x70, 0x65,
|
||||
0x52, 0x04, 0x74, 0x79, 0x70, 0x65, 0x12, 0x2b, 0x0a, 0x09, 0x6f, 0x70, 0x65, 0x72, 0x61, 0x74,
|
||||
0x69, 0x6f, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0d, 0x2e, 0x76, 0x31, 0x2e, 0x4f,
|
||||
0x70, 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x09, 0x6f, 0x70, 0x65, 0x72, 0x61, 0x74,
|
||||
0x69, 0x6f, 0x6e, 0x22, 0x4b, 0x0a, 0x0f, 0x4f, 0x70, 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e,
|
||||
0x42, 0x61, 0x63, 0x6b, 0x75, 0x70, 0x12, 0x38, 0x0a, 0x0b, 0x6c, 0x61, 0x73, 0x74, 0x5f, 0x73,
|
||||
0x74, 0x61, 0x74, 0x75, 0x73, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x17, 0x2e, 0x76, 0x31,
|
||||
0x2e, 0x42, 0x61, 0x63, 0x6b, 0x75, 0x70, 0x50, 0x72, 0x6f, 0x67, 0x72, 0x65, 0x73, 0x73, 0x45,
|
||||
0x6e, 0x74, 0x72, 0x79, 0x52, 0x0a, 0x6c, 0x61, 0x73, 0x74, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73,
|
||||
0x22, 0x82, 0x01, 0x0a, 0x16, 0x4f, 0x70, 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x49, 0x6e,
|
||||
0x64, 0x65, 0x78, 0x53, 0x6e, 0x61, 0x70, 0x73, 0x68, 0x6f, 0x74, 0x12, 0x2e, 0x0a, 0x08, 0x73,
|
||||
0x6e, 0x61, 0x70, 0x73, 0x68, 0x6f, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x12, 0x2e,
|
||||
0x76, 0x31, 0x2e, 0x52, 0x65, 0x73, 0x74, 0x69, 0x63, 0x53, 0x6e, 0x61, 0x70, 0x73, 0x68, 0x6f,
|
||||
0x74, 0x52, 0x08, 0x73, 0x6e, 0x61, 0x70, 0x73, 0x68, 0x6f, 0x74, 0x12, 0x16, 0x0a, 0x06, 0x66,
|
||||
0x6f, 0x72, 0x67, 0x6f, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x08, 0x52, 0x06, 0x66, 0x6f, 0x72,
|
||||
0x67, 0x6f, 0x74, 0x12, 0x20, 0x0a, 0x0c, 0x66, 0x6f, 0x72, 0x67, 0x6f, 0x74, 0x5f, 0x62, 0x79,
|
||||
0x5f, 0x6f, 0x70, 0x18, 0x04, 0x20, 0x01, 0x28, 0x03, 0x52, 0x0a, 0x66, 0x6f, 0x72, 0x67, 0x6f,
|
||||
0x74, 0x42, 0x79, 0x4f, 0x70, 0x22, 0x3d, 0x0a, 0x0f, 0x4f, 0x70, 0x65, 0x72, 0x61, 0x74, 0x69,
|
||||
0x6f, 0x6e, 0x46, 0x6f, 0x72, 0x67, 0x65, 0x74, 0x12, 0x2a, 0x0a, 0x06, 0x66, 0x6f, 0x72, 0x67,
|
||||
0x65, 0x74, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x12, 0x2e, 0x76, 0x31, 0x2e, 0x52, 0x65,
|
||||
0x73, 0x74, 0x69, 0x63, 0x53, 0x6e, 0x61, 0x70, 0x73, 0x68, 0x6f, 0x74, 0x52, 0x06, 0x66, 0x6f,
|
||||
0x72, 0x67, 0x65, 0x74, 0x22, 0x28, 0x0a, 0x0e, 0x4f, 0x70, 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f,
|
||||
0x6e, 0x50, 0x72, 0x75, 0x6e, 0x65, 0x12, 0x16, 0x0a, 0x06, 0x6f, 0x75, 0x74, 0x70, 0x75, 0x74,
|
||||
0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x6f, 0x75, 0x74, 0x70, 0x75, 0x74, 0x2a, 0x4d,
|
||||
0x0a, 0x12, 0x4f, 0x70, 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x45, 0x76, 0x65, 0x6e, 0x74,
|
||||
0x54, 0x79, 0x70, 0x65, 0x12, 0x11, 0x0a, 0x0d, 0x45, 0x56, 0x45, 0x4e, 0x54, 0x5f, 0x55, 0x4e,
|
||||
0x4b, 0x4e, 0x4f, 0x57, 0x4e, 0x10, 0x00, 0x12, 0x11, 0x0a, 0x0d, 0x45, 0x56, 0x45, 0x4e, 0x54,
|
||||
0x5f, 0x43, 0x52, 0x45, 0x41, 0x54, 0x45, 0x44, 0x10, 0x01, 0x12, 0x11, 0x0a, 0x0d, 0x45, 0x56,
|
||||
0x45, 0x4e, 0x54, 0x5f, 0x55, 0x50, 0x44, 0x41, 0x54, 0x45, 0x44, 0x10, 0x02, 0x2a, 0xae, 0x01,
|
||||
0x0a, 0x0f, 0x4f, 0x70, 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x53, 0x74, 0x61, 0x74, 0x75,
|
||||
0x73, 0x12, 0x12, 0x0a, 0x0e, 0x53, 0x54, 0x41, 0x54, 0x55, 0x53, 0x5f, 0x55, 0x4e, 0x4b, 0x4e,
|
||||
0x4f, 0x57, 0x4e, 0x10, 0x00, 0x12, 0x12, 0x0a, 0x0e, 0x53, 0x54, 0x41, 0x54, 0x55, 0x53, 0x5f,
|
||||
0x50, 0x45, 0x4e, 0x44, 0x49, 0x4e, 0x47, 0x10, 0x01, 0x12, 0x15, 0x0a, 0x11, 0x53, 0x54, 0x41,
|
||||
0x54, 0x55, 0x53, 0x5f, 0x49, 0x4e, 0x50, 0x52, 0x4f, 0x47, 0x52, 0x45, 0x53, 0x53, 0x10, 0x02,
|
||||
0x12, 0x12, 0x0a, 0x0e, 0x53, 0x54, 0x41, 0x54, 0x55, 0x53, 0x5f, 0x53, 0x55, 0x43, 0x43, 0x45,
|
||||
0x53, 0x53, 0x10, 0x03, 0x12, 0x10, 0x0a, 0x0c, 0x53, 0x54, 0x41, 0x54, 0x55, 0x53, 0x5f, 0x45,
|
||||
0x52, 0x52, 0x4f, 0x52, 0x10, 0x04, 0x12, 0x1b, 0x0a, 0x17, 0x53, 0x54, 0x41, 0x54, 0x55, 0x53,
|
||||
0x5f, 0x53, 0x59, 0x53, 0x54, 0x45, 0x4d, 0x5f, 0x43, 0x41, 0x4e, 0x43, 0x45, 0x4c, 0x4c, 0x45,
|
||||
0x44, 0x10, 0x05, 0x12, 0x19, 0x0a, 0x15, 0x53, 0x54, 0x41, 0x54, 0x55, 0x53, 0x5f, 0x55, 0x53,
|
||||
0x45, 0x52, 0x5f, 0x43, 0x41, 0x4e, 0x43, 0x45, 0x4c, 0x4c, 0x45, 0x44, 0x10, 0x06, 0x42, 0x2e,
|
||||
0x5a, 0x2c, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x67, 0x61, 0x72,
|
||||
0x65, 0x74, 0x68, 0x67, 0x65, 0x6f, 0x72, 0x67, 0x65, 0x2f, 0x72, 0x65, 0x73, 0x74, 0x69, 0x63,
|
||||
0x75, 0x69, 0x2f, 0x67, 0x6f, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x76, 0x31, 0x62, 0x06,
|
||||
0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
|
||||
0x73, 0x74, 0x69, 0x63, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x0f, 0x76, 0x31, 0x2f, 0x63,
|
||||
0x6f, 0x6e, 0x66, 0x69, 0x67, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x3e, 0x0a, 0x0d, 0x4f,
|
||||
0x70, 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x4c, 0x69, 0x73, 0x74, 0x12, 0x2d, 0x0a, 0x0a,
|
||||
0x6f, 0x70, 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b,
|
||||
0x32, 0x0d, 0x2e, 0x76, 0x31, 0x2e, 0x4f, 0x70, 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52,
|
||||
0x0a, 0x6f, 0x70, 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x22, 0xbb, 0x04, 0x0a, 0x09,
|
||||
0x4f, 0x70, 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18,
|
||||
0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x02, 0x69, 0x64, 0x12, 0x17, 0x0a, 0x07, 0x72, 0x65, 0x70,
|
||||
0x6f, 0x5f, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x72, 0x65, 0x70, 0x6f,
|
||||
0x49, 0x64, 0x12, 0x17, 0x0a, 0x07, 0x70, 0x6c, 0x61, 0x6e, 0x5f, 0x69, 0x64, 0x18, 0x03, 0x20,
|
||||
0x01, 0x28, 0x09, 0x52, 0x06, 0x70, 0x6c, 0x61, 0x6e, 0x49, 0x64, 0x12, 0x1f, 0x0a, 0x0b, 0x73,
|
||||
0x6e, 0x61, 0x70, 0x73, 0x68, 0x6f, 0x74, 0x5f, 0x69, 0x64, 0x18, 0x08, 0x20, 0x01, 0x28, 0x09,
|
||||
0x52, 0x0a, 0x73, 0x6e, 0x61, 0x70, 0x73, 0x68, 0x6f, 0x74, 0x49, 0x64, 0x12, 0x2b, 0x0a, 0x06,
|
||||
0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x13, 0x2e, 0x76,
|
||||
0x31, 0x2e, 0x4f, 0x70, 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x53, 0x74, 0x61, 0x74, 0x75,
|
||||
0x73, 0x52, 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x2b, 0x0a, 0x12, 0x75, 0x6e, 0x69,
|
||||
0x78, 0x5f, 0x74, 0x69, 0x6d, 0x65, 0x5f, 0x73, 0x74, 0x61, 0x72, 0x74, 0x5f, 0x6d, 0x73, 0x18,
|
||||
0x05, 0x20, 0x01, 0x28, 0x03, 0x52, 0x0f, 0x75, 0x6e, 0x69, 0x78, 0x54, 0x69, 0x6d, 0x65, 0x53,
|
||||
0x74, 0x61, 0x72, 0x74, 0x4d, 0x73, 0x12, 0x27, 0x0a, 0x10, 0x75, 0x6e, 0x69, 0x78, 0x5f, 0x74,
|
||||
0x69, 0x6d, 0x65, 0x5f, 0x65, 0x6e, 0x64, 0x5f, 0x6d, 0x73, 0x18, 0x06, 0x20, 0x01, 0x28, 0x03,
|
||||
0x52, 0x0d, 0x75, 0x6e, 0x69, 0x78, 0x54, 0x69, 0x6d, 0x65, 0x45, 0x6e, 0x64, 0x4d, 0x73, 0x12,
|
||||
0x27, 0x0a, 0x0f, 0x64, 0x69, 0x73, 0x70, 0x6c, 0x61, 0x79, 0x5f, 0x6d, 0x65, 0x73, 0x73, 0x61,
|
||||
0x67, 0x65, 0x18, 0x07, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0e, 0x64, 0x69, 0x73, 0x70, 0x6c, 0x61,
|
||||
0x79, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x12, 0x40, 0x0a, 0x10, 0x6f, 0x70, 0x65, 0x72,
|
||||
0x61, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x62, 0x61, 0x63, 0x6b, 0x75, 0x70, 0x18, 0x64, 0x20, 0x01,
|
||||
0x28, 0x0b, 0x32, 0x13, 0x2e, 0x76, 0x31, 0x2e, 0x4f, 0x70, 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f,
|
||||
0x6e, 0x42, 0x61, 0x63, 0x6b, 0x75, 0x70, 0x48, 0x00, 0x52, 0x0f, 0x6f, 0x70, 0x65, 0x72, 0x61,
|
||||
0x74, 0x69, 0x6f, 0x6e, 0x42, 0x61, 0x63, 0x6b, 0x75, 0x70, 0x12, 0x56, 0x0a, 0x18, 0x6f, 0x70,
|
||||
0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x69, 0x6e, 0x64, 0x65, 0x78, 0x5f, 0x73, 0x6e,
|
||||
0x61, 0x70, 0x73, 0x68, 0x6f, 0x74, 0x18, 0x65, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x76,
|
||||
0x31, 0x2e, 0x4f, 0x70, 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x49, 0x6e, 0x64, 0x65, 0x78,
|
||||
0x53, 0x6e, 0x61, 0x70, 0x73, 0x68, 0x6f, 0x74, 0x48, 0x00, 0x52, 0x16, 0x6f, 0x70, 0x65, 0x72,
|
||||
0x61, 0x74, 0x69, 0x6f, 0x6e, 0x49, 0x6e, 0x64, 0x65, 0x78, 0x53, 0x6e, 0x61, 0x70, 0x73, 0x68,
|
||||
0x6f, 0x74, 0x12, 0x40, 0x0a, 0x10, 0x6f, 0x70, 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x5f,
|
||||
0x66, 0x6f, 0x72, 0x67, 0x65, 0x74, 0x18, 0x66, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x13, 0x2e, 0x76,
|
||||
0x31, 0x2e, 0x4f, 0x70, 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x46, 0x6f, 0x72, 0x67, 0x65,
|
||||
0x74, 0x48, 0x00, 0x52, 0x0f, 0x6f, 0x70, 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x46, 0x6f,
|
||||
0x72, 0x67, 0x65, 0x74, 0x12, 0x3d, 0x0a, 0x0f, 0x6f, 0x70, 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f,
|
||||
0x6e, 0x5f, 0x70, 0x72, 0x75, 0x6e, 0x65, 0x18, 0x67, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x12, 0x2e,
|
||||
0x76, 0x31, 0x2e, 0x4f, 0x70, 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x50, 0x72, 0x75, 0x6e,
|
||||
0x65, 0x48, 0x00, 0x52, 0x0e, 0x6f, 0x70, 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x50, 0x72,
|
||||
0x75, 0x6e, 0x65, 0x42, 0x04, 0x0a, 0x02, 0x6f, 0x70, 0x22, 0x69, 0x0a, 0x0e, 0x4f, 0x70, 0x65,
|
||||
0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x12, 0x2a, 0x0a, 0x04, 0x74,
|
||||
0x79, 0x70, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x16, 0x2e, 0x76, 0x31, 0x2e, 0x4f,
|
||||
0x70, 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x54, 0x79, 0x70,
|
||||
0x65, 0x52, 0x04, 0x74, 0x79, 0x70, 0x65, 0x12, 0x2b, 0x0a, 0x09, 0x6f, 0x70, 0x65, 0x72, 0x61,
|
||||
0x74, 0x69, 0x6f, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0d, 0x2e, 0x76, 0x31, 0x2e,
|
||||
0x4f, 0x70, 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x09, 0x6f, 0x70, 0x65, 0x72, 0x61,
|
||||
0x74, 0x69, 0x6f, 0x6e, 0x22, 0x4b, 0x0a, 0x0f, 0x4f, 0x70, 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f,
|
||||
0x6e, 0x42, 0x61, 0x63, 0x6b, 0x75, 0x70, 0x12, 0x38, 0x0a, 0x0b, 0x6c, 0x61, 0x73, 0x74, 0x5f,
|
||||
0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x17, 0x2e, 0x76,
|
||||
0x31, 0x2e, 0x42, 0x61, 0x63, 0x6b, 0x75, 0x70, 0x50, 0x72, 0x6f, 0x67, 0x72, 0x65, 0x73, 0x73,
|
||||
0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, 0x0a, 0x6c, 0x61, 0x73, 0x74, 0x53, 0x74, 0x61, 0x74, 0x75,
|
||||
0x73, 0x22, 0x82, 0x01, 0x0a, 0x16, 0x4f, 0x70, 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x49,
|
||||
0x6e, 0x64, 0x65, 0x78, 0x53, 0x6e, 0x61, 0x70, 0x73, 0x68, 0x6f, 0x74, 0x12, 0x2e, 0x0a, 0x08,
|
||||
0x73, 0x6e, 0x61, 0x70, 0x73, 0x68, 0x6f, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x12,
|
||||
0x2e, 0x76, 0x31, 0x2e, 0x52, 0x65, 0x73, 0x74, 0x69, 0x63, 0x53, 0x6e, 0x61, 0x70, 0x73, 0x68,
|
||||
0x6f, 0x74, 0x52, 0x08, 0x73, 0x6e, 0x61, 0x70, 0x73, 0x68, 0x6f, 0x74, 0x12, 0x16, 0x0a, 0x06,
|
||||
0x66, 0x6f, 0x72, 0x67, 0x6f, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x08, 0x52, 0x06, 0x66, 0x6f,
|
||||
0x72, 0x67, 0x6f, 0x74, 0x12, 0x20, 0x0a, 0x0c, 0x66, 0x6f, 0x72, 0x67, 0x6f, 0x74, 0x5f, 0x62,
|
||||
0x79, 0x5f, 0x6f, 0x70, 0x18, 0x04, 0x20, 0x01, 0x28, 0x03, 0x52, 0x0a, 0x66, 0x6f, 0x72, 0x67,
|
||||
0x6f, 0x74, 0x42, 0x79, 0x4f, 0x70, 0x22, 0x6a, 0x0a, 0x0f, 0x4f, 0x70, 0x65, 0x72, 0x61, 0x74,
|
||||
0x69, 0x6f, 0x6e, 0x46, 0x6f, 0x72, 0x67, 0x65, 0x74, 0x12, 0x2a, 0x0a, 0x06, 0x66, 0x6f, 0x72,
|
||||
0x67, 0x65, 0x74, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x12, 0x2e, 0x76, 0x31, 0x2e, 0x52,
|
||||
0x65, 0x73, 0x74, 0x69, 0x63, 0x53, 0x6e, 0x61, 0x70, 0x73, 0x68, 0x6f, 0x74, 0x52, 0x06, 0x66,
|
||||
0x6f, 0x72, 0x67, 0x65, 0x74, 0x12, 0x2b, 0x0a, 0x06, 0x70, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x18,
|
||||
0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x13, 0x2e, 0x76, 0x31, 0x2e, 0x52, 0x65, 0x74, 0x65, 0x6e,
|
||||
0x74, 0x69, 0x6f, 0x6e, 0x50, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x52, 0x06, 0x70, 0x6f, 0x6c, 0x69,
|
||||
0x63, 0x79, 0x22, 0x28, 0x0a, 0x0e, 0x4f, 0x70, 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x50,
|
||||
0x72, 0x75, 0x6e, 0x65, 0x12, 0x16, 0x0a, 0x06, 0x6f, 0x75, 0x74, 0x70, 0x75, 0x74, 0x18, 0x01,
|
||||
0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x6f, 0x75, 0x74, 0x70, 0x75, 0x74, 0x2a, 0x4d, 0x0a, 0x12,
|
||||
0x4f, 0x70, 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x54, 0x79,
|
||||
0x70, 0x65, 0x12, 0x11, 0x0a, 0x0d, 0x45, 0x56, 0x45, 0x4e, 0x54, 0x5f, 0x55, 0x4e, 0x4b, 0x4e,
|
||||
0x4f, 0x57, 0x4e, 0x10, 0x00, 0x12, 0x11, 0x0a, 0x0d, 0x45, 0x56, 0x45, 0x4e, 0x54, 0x5f, 0x43,
|
||||
0x52, 0x45, 0x41, 0x54, 0x45, 0x44, 0x10, 0x01, 0x12, 0x11, 0x0a, 0x0d, 0x45, 0x56, 0x45, 0x4e,
|
||||
0x54, 0x5f, 0x55, 0x50, 0x44, 0x41, 0x54, 0x45, 0x44, 0x10, 0x02, 0x2a, 0xae, 0x01, 0x0a, 0x0f,
|
||||
0x4f, 0x70, 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x12,
|
||||
0x12, 0x0a, 0x0e, 0x53, 0x54, 0x41, 0x54, 0x55, 0x53, 0x5f, 0x55, 0x4e, 0x4b, 0x4e, 0x4f, 0x57,
|
||||
0x4e, 0x10, 0x00, 0x12, 0x12, 0x0a, 0x0e, 0x53, 0x54, 0x41, 0x54, 0x55, 0x53, 0x5f, 0x50, 0x45,
|
||||
0x4e, 0x44, 0x49, 0x4e, 0x47, 0x10, 0x01, 0x12, 0x15, 0x0a, 0x11, 0x53, 0x54, 0x41, 0x54, 0x55,
|
||||
0x53, 0x5f, 0x49, 0x4e, 0x50, 0x52, 0x4f, 0x47, 0x52, 0x45, 0x53, 0x53, 0x10, 0x02, 0x12, 0x12,
|
||||
0x0a, 0x0e, 0x53, 0x54, 0x41, 0x54, 0x55, 0x53, 0x5f, 0x53, 0x55, 0x43, 0x43, 0x45, 0x53, 0x53,
|
||||
0x10, 0x03, 0x12, 0x10, 0x0a, 0x0c, 0x53, 0x54, 0x41, 0x54, 0x55, 0x53, 0x5f, 0x45, 0x52, 0x52,
|
||||
0x4f, 0x52, 0x10, 0x04, 0x12, 0x1b, 0x0a, 0x17, 0x53, 0x54, 0x41, 0x54, 0x55, 0x53, 0x5f, 0x53,
|
||||
0x59, 0x53, 0x54, 0x45, 0x4d, 0x5f, 0x43, 0x41, 0x4e, 0x43, 0x45, 0x4c, 0x4c, 0x45, 0x44, 0x10,
|
||||
0x05, 0x12, 0x19, 0x0a, 0x15, 0x53, 0x54, 0x41, 0x54, 0x55, 0x53, 0x5f, 0x55, 0x53, 0x45, 0x52,
|
||||
0x5f, 0x43, 0x41, 0x4e, 0x43, 0x45, 0x4c, 0x4c, 0x45, 0x44, 0x10, 0x06, 0x42, 0x2e, 0x5a, 0x2c,
|
||||
0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x67, 0x61, 0x72, 0x65, 0x74,
|
||||
0x68, 0x67, 0x65, 0x6f, 0x72, 0x67, 0x65, 0x2f, 0x72, 0x65, 0x73, 0x74, 0x69, 0x63, 0x75, 0x69,
|
||||
0x2f, 0x67, 0x6f, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x76, 0x31, 0x62, 0x06, 0x70, 0x72,
|
||||
0x6f, 0x74, 0x6f, 0x33,
|
||||
}
|
||||
|
||||
var (
|
||||
@@ -741,6 +753,7 @@ var file_v1_operations_proto_goTypes = []interface{}{
|
||||
(*OperationPrune)(nil), // 8: v1.OperationPrune
|
||||
(*BackupProgressEntry)(nil), // 9: v1.BackupProgressEntry
|
||||
(*ResticSnapshot)(nil), // 10: v1.ResticSnapshot
|
||||
(*RetentionPolicy)(nil), // 11: v1.RetentionPolicy
|
||||
}
|
||||
var file_v1_operations_proto_depIdxs = []int32{
|
||||
3, // 0: v1.OperationList.operations:type_name -> v1.Operation
|
||||
@@ -754,11 +767,12 @@ var file_v1_operations_proto_depIdxs = []int32{
|
||||
9, // 8: v1.OperationBackup.last_status:type_name -> v1.BackupProgressEntry
|
||||
10, // 9: v1.OperationIndexSnapshot.snapshot:type_name -> v1.ResticSnapshot
|
||||
10, // 10: v1.OperationForget.forget:type_name -> v1.ResticSnapshot
|
||||
11, // [11:11] is the sub-list for method output_type
|
||||
11, // [11:11] is the sub-list for method input_type
|
||||
11, // [11:11] is the sub-list for extension type_name
|
||||
11, // [11:11] is the sub-list for extension extendee
|
||||
0, // [0:11] is the sub-list for field type_name
|
||||
11, // 11: v1.OperationForget.policy:type_name -> v1.RetentionPolicy
|
||||
12, // [12:12] is the sub-list for method output_type
|
||||
12, // [12:12] is the sub-list for method input_type
|
||||
12, // [12:12] is the sub-list for extension type_name
|
||||
12, // [12:12] is the sub-list for extension extendee
|
||||
0, // [0:12] is the sub-list for field type_name
|
||||
}
|
||||
|
||||
func init() { file_v1_operations_proto_init() }
|
||||
@@ -767,6 +781,7 @@ func file_v1_operations_proto_init() {
|
||||
return
|
||||
}
|
||||
file_v1_restic_proto_init()
|
||||
file_v1_config_proto_init()
|
||||
if !protoimpl.UnsafeEnabled {
|
||||
file_v1_operations_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} {
|
||||
switch v := v.(*OperationList); i {
|
||||
|
||||
@@ -79,6 +79,7 @@ func (t *ForgetTask) Run(ctx context.Context) error {
|
||||
}
|
||||
|
||||
forgetOp.OperationForget.Forget = append(forgetOp.OperationForget.Forget, forgot...)
|
||||
forgetOp.OperationForget.Policy = t.plan.Retention
|
||||
|
||||
var ops []*v1.Operation
|
||||
for _, forgot := range forgot {
|
||||
|
||||
@@ -68,14 +68,13 @@ func (o *Orchestrator) ApplyConfig(cfg *v1.Config) error {
|
||||
defer o.mu.Unlock()
|
||||
o.config = cfg
|
||||
|
||||
zap.L().Info("Applying config to orchestrator")
|
||||
|
||||
// Update the config provided to the repo pool.
|
||||
if err := o.repoPool.configProvider.Update(cfg); err != nil {
|
||||
return fmt.Errorf("failed to update repo pool config: %w", err)
|
||||
}
|
||||
|
||||
// reset queued tasks, this may loose any ephemeral operations scheduled by RPC. Tasks in progress aren't returned by Reset() so they will not be cancelled.
|
||||
zap.L().Info("Applying config to orchestrator, waiting for task queue reset.")
|
||||
removedTasks := o.taskQueue.Reset()
|
||||
for _, t := range removedTasks {
|
||||
if err := t.task.Cancel(v1.OperationStatus_STATUS_SYSTEM_CANCELLED); err != nil {
|
||||
@@ -84,6 +83,7 @@ func (o *Orchestrator) ApplyConfig(cfg *v1.Config) error {
|
||||
zap.L().Debug("queued task cancelled due to config change", zap.String("task", t.task.Name()))
|
||||
}
|
||||
}
|
||||
zap.L().Info("Applied config to orchestrator, task queue reset. Rescheduling planned tasks now.")
|
||||
|
||||
// Requeue tasks that are affected by the config change.
|
||||
for _, plan := range cfg.Plans {
|
||||
|
||||
@@ -5,6 +5,7 @@ package v1;
|
||||
option go_package = "github.com/garethgeorge/resticui/go/proto/v1";
|
||||
|
||||
import "v1/restic.proto";
|
||||
import "v1/config.proto";
|
||||
|
||||
message OperationList {
|
||||
repeated Operation operations = 1;
|
||||
@@ -72,6 +73,7 @@ message OperationIndexSnapshot {
|
||||
// OperationForget tracks a forget operation.
|
||||
message OperationForget {
|
||||
repeated ResticSnapshot forget = 1;
|
||||
RetentionPolicy policy = 2;
|
||||
}
|
||||
|
||||
// OperationPrune tracks a prune operation.
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
* This file is a generated Typescript file for GRPC Gateway, DO NOT MODIFY
|
||||
*/
|
||||
|
||||
import * as V1Config from "./config.pb"
|
||||
import * as V1Restic from "./restic.pb"
|
||||
|
||||
type Absent<T, K extends keyof T> = { [k in Exclude<keyof T, K>]?: undefined };
|
||||
@@ -67,6 +68,7 @@ export type OperationIndexSnapshot = {
|
||||
|
||||
export type OperationForget = {
|
||||
forget?: V1Restic.ResticSnapshot[]
|
||||
policy?: V1Config.RetentionPolicy
|
||||
}
|
||||
|
||||
export type OperationPrune = {
|
||||
|
||||
@@ -1,5 +1,9 @@
|
||||
import React, { useEffect, useState } from "react";
|
||||
import { Operation, OperationStatus } from "../../gen/ts/v1/operations.pb";
|
||||
import {
|
||||
Operation,
|
||||
OperationEvent,
|
||||
OperationStatus,
|
||||
} from "../../gen/ts/v1/operations.pb";
|
||||
import {
|
||||
Card,
|
||||
Col,
|
||||
@@ -15,12 +19,18 @@ import {
|
||||
ExclamationCircleOutlined,
|
||||
PaperClipOutlined,
|
||||
SaveOutlined,
|
||||
DeleteOutlined,
|
||||
} from "@ant-design/icons";
|
||||
import { BackupProgressEntry, ResticSnapshot } from "../../gen/ts/v1/restic.pb";
|
||||
import {
|
||||
BackupInfo,
|
||||
BackupInfoCollector,
|
||||
EOperation,
|
||||
buildOperationListListener,
|
||||
getOperations,
|
||||
shouldHideStatus,
|
||||
subscribeToOperations,
|
||||
toEop,
|
||||
unsubscribeFromOperations,
|
||||
} from "../state/oplog";
|
||||
import { SnapshotBrowser } from "./SnapshotBrowser";
|
||||
@@ -32,26 +42,67 @@ import {
|
||||
} from "../lib/formatting";
|
||||
import _ from "lodash";
|
||||
import { GetOperationsRequest } from "../../gen/ts/v1/service.pb";
|
||||
import { useAlertApi } from "./Alerts";
|
||||
|
||||
export const OperationList = ({
|
||||
req,
|
||||
}: React.PropsWithoutRef<{ req: GetOperationsRequest }>) => {
|
||||
const [operations, setOperations] = useState<EOperation[]>([]);
|
||||
console.log("operation list with req: ", req);
|
||||
useBackups,
|
||||
}: React.PropsWithoutRef<{
|
||||
req?: GetOperationsRequest;
|
||||
useBackups?: BackupInfo[];
|
||||
}>) => {
|
||||
const alertApi = useAlertApi();
|
||||
|
||||
useEffect(() => {
|
||||
const lis = buildOperationListListener(req, (event, operation, opList) => {
|
||||
console.log("got list: ", JSON.stringify(opList, null, 2));
|
||||
setOperations(opList);
|
||||
});
|
||||
subscribeToOperations(lis);
|
||||
let backups: BackupInfo[] = [];
|
||||
if (req) {
|
||||
const [backupState, setBackups] = useState<BackupInfo[]>(useBackups || []);
|
||||
backups = backupState;
|
||||
|
||||
return () => {
|
||||
unsubscribeFromOperations(lis);
|
||||
};
|
||||
}, [JSON.stringify(req)]);
|
||||
// track backups for this operation tree view.
|
||||
useEffect(() => {
|
||||
if (!req) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (operations.length === 0) {
|
||||
const backupCollector = new BackupInfoCollector();
|
||||
const lis = (opEvent: OperationEvent) => {
|
||||
if (!!req.planId && opEvent.operation!.planId !== req.planId) {
|
||||
return;
|
||||
}
|
||||
if (!!req.repoId && opEvent.operation!.repoId !== req.repoId) {
|
||||
return;
|
||||
}
|
||||
backupCollector.addOperation(opEvent.type!, opEvent.operation!);
|
||||
};
|
||||
subscribeToOperations(lis);
|
||||
|
||||
backupCollector.subscribe(() => {
|
||||
let backups = backupCollector.getAll();
|
||||
backups = backups.filter((b) => {
|
||||
return !shouldHideStatus(b.status);
|
||||
});
|
||||
backups.sort((a, b) => {
|
||||
return b.startTimeMs - a.startTimeMs;
|
||||
});
|
||||
setBackups(backups);
|
||||
});
|
||||
|
||||
getOperations(req)
|
||||
.then((ops) => {
|
||||
backupCollector.bulkAddOperations(ops);
|
||||
})
|
||||
.catch((e) => {
|
||||
alertApi!.error("Failed to fetch operations: " + e.message);
|
||||
});
|
||||
return () => {
|
||||
unsubscribeFromOperations(lis);
|
||||
};
|
||||
}, [JSON.stringify(req)]);
|
||||
} else {
|
||||
backups = useBackups || [];
|
||||
}
|
||||
|
||||
if (backups.length === 0) {
|
||||
return (
|
||||
<Empty
|
||||
description="No operations yet."
|
||||
@@ -60,41 +111,27 @@ export const OperationList = ({
|
||||
);
|
||||
}
|
||||
|
||||
// groups items by snapshotID if one can be identified, otherwise by operation ID.
|
||||
const groupedItems = _.values(
|
||||
_.groupBy(operations, (op: EOperation) => {
|
||||
return getSnapshotId(op) || op.id!;
|
||||
})
|
||||
);
|
||||
groupedItems.sort((a, b) => {
|
||||
return b[0].parsedTime - a[0].parsedTime;
|
||||
});
|
||||
groupedItems.forEach((group) => {
|
||||
group.sort((a, b) => {
|
||||
return b.parsedTime - a.parsedTime;
|
||||
});
|
||||
});
|
||||
|
||||
return (
|
||||
<List
|
||||
itemLayout="horizontal"
|
||||
size="small"
|
||||
dataSource={groupedItems}
|
||||
renderItem={(group, index) => {
|
||||
if (group.length === 1) {
|
||||
return <OperationRow key={group[0].id!} operation={group[0]} />;
|
||||
dataSource={backups}
|
||||
renderItem={(backup) => {
|
||||
const ops = backup.operations;
|
||||
if (ops.length === 1) {
|
||||
return <OperationRow key={ops[0].id!} operation={toEop(ops[0])} />;
|
||||
}
|
||||
|
||||
return (
|
||||
<Card size="small" style={{ margin: "5px" }}>
|
||||
{group.map((op) => (
|
||||
<OperationRow key={op.id!} operation={op} />
|
||||
{ops.map((op) => (
|
||||
<OperationRow key={op.id!} operation={toEop(op)} />
|
||||
))}
|
||||
</Card>
|
||||
);
|
||||
}}
|
||||
pagination={
|
||||
operations.length > 50
|
||||
backups.length > 50
|
||||
? { position: "both", align: "center", defaultPageSize: 50 }
|
||||
: undefined
|
||||
}
|
||||
@@ -199,6 +236,70 @@ export const OperationRow = ({
|
||||
/>
|
||||
</List.Item>
|
||||
);
|
||||
} else if (operation.operationForget) {
|
||||
const forgetOp = operation.operationForget;
|
||||
if (forgetOp.forget?.length === 0) {
|
||||
return null;
|
||||
}
|
||||
|
||||
const policy = forgetOp.policy! || {};
|
||||
const policyDesc = [];
|
||||
if (policy.keepLastN) {
|
||||
policyDesc.push(`Keep Last ${policy.keepLastN} Snapshots`);
|
||||
}
|
||||
if (policy.keepHourly) {
|
||||
policyDesc.push(`Keep Hourly for ${policy.keepHourly} Hours`);
|
||||
}
|
||||
if (policy.keepDaily) {
|
||||
policyDesc.push(`Keep Daily for ${policy.keepDaily} Days`);
|
||||
}
|
||||
if (policy.keepWeekly) {
|
||||
policyDesc.push(`Keep Weekly for ${policy.keepWeekly} Weeks`);
|
||||
}
|
||||
if (policy.keepMonthly) {
|
||||
policyDesc.push(`Keep Monthly for ${policy.keepMonthly} Months`);
|
||||
}
|
||||
if (policy.keepYearly) {
|
||||
policyDesc.push(`Keep Yearly for ${policy.keepYearly} Years`);
|
||||
}
|
||||
|
||||
return (
|
||||
<List.Item>
|
||||
<List.Item.Meta
|
||||
title={
|
||||
<>{formatTime(operation.unixTimeStartMs!)} - Forget Operation</>
|
||||
}
|
||||
avatar={<DeleteOutlined style={{ color }} />}
|
||||
description={
|
||||
<>
|
||||
<p></p>
|
||||
<Collapse
|
||||
size="small"
|
||||
destroyInactivePanel
|
||||
items={[
|
||||
{
|
||||
key: 1,
|
||||
label:
|
||||
"Removed " +
|
||||
forgetOp.forget?.length +
|
||||
" Snapshots (Policy Details)",
|
||||
children: (
|
||||
<div>
|
||||
<ul>
|
||||
{policyDesc.map((desc) => (
|
||||
<li>{desc}</li>
|
||||
))}
|
||||
</ul>
|
||||
</div>
|
||||
),
|
||||
},
|
||||
]}
|
||||
/>
|
||||
</>
|
||||
}
|
||||
/>
|
||||
</List.Item>
|
||||
);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@@ -78,9 +78,10 @@ export const OperationTree = ({
|
||||
|
||||
if (backups.length === 0) {
|
||||
return (
|
||||
<div>
|
||||
<QuestionOutlined /> No operations yet.
|
||||
</div>
|
||||
<Empty
|
||||
description="No backups yet."
|
||||
image={Empty.PRESENTED_IMAGE_SIMPLE}
|
||||
></Empty>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -92,13 +93,10 @@ export const OperationTree = ({
|
||||
if (!backup) {
|
||||
oplist = <Empty description="Backup not found." />;
|
||||
} else {
|
||||
const req: GetOperationsRequest = {
|
||||
ids: backup.operations.map((op) => op.id!),
|
||||
};
|
||||
oplist = (
|
||||
<>
|
||||
<h3>Backup at {formatTime(backup.displayTime)}</h3>
|
||||
<OperationList req={req} />
|
||||
<OperationList key={backup.id} useBackups={[backup]} />
|
||||
</>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -65,58 +65,6 @@ export const unsubscribeFromOperations = (
|
||||
}
|
||||
};
|
||||
|
||||
export const buildOperationListListener = (
|
||||
req: GetOperationsRequest,
|
||||
callback: (
|
||||
event: OperationEventType | null,
|
||||
operation: EOperation | null,
|
||||
list: EOperation[]
|
||||
) => void
|
||||
) => {
|
||||
let operations: EOperation[] = [];
|
||||
|
||||
(async () => {
|
||||
const opsFromServer = await getOperations(req);
|
||||
operations.push(...opsFromServer);
|
||||
operations = _.uniqBy(opsFromServer, (o) => o.id!);
|
||||
operations.sort((a, b) => {
|
||||
return a.parsedTime! - b.parsedTime!;
|
||||
});
|
||||
callback(null, null, operations);
|
||||
})();
|
||||
|
||||
return (event: OperationEvent) => {
|
||||
const op = toEop(event.operation!);
|
||||
const type = event.type!;
|
||||
if (!!req.planId && op.planId !== req.planId) {
|
||||
return;
|
||||
}
|
||||
if (!!req.repoId && op.repoId !== req.repoId) {
|
||||
return;
|
||||
}
|
||||
if (req.snapshotId && op.snapshotId !== req.snapshotId) {
|
||||
return;
|
||||
}
|
||||
if (req.ids && !req.ids.includes(op.id!)) {
|
||||
return;
|
||||
}
|
||||
if (type === OperationEventType.EVENT_UPDATED) {
|
||||
const index = operations.findIndex((o) => o.id === op.id);
|
||||
if (index > -1) {
|
||||
operations[index] = op;
|
||||
} else {
|
||||
operations.push(op);
|
||||
operations.sort((a, b) => {
|
||||
return a.parsedTime! - b.parsedTime!;
|
||||
});
|
||||
}
|
||||
} else if (type === OperationEventType.EVENT_CREATED) {
|
||||
operations.push(op);
|
||||
}
|
||||
callback(event.type || null, op, operations);
|
||||
};
|
||||
};
|
||||
|
||||
export const toEop = (op: Operation): EOperation => {
|
||||
const time = parseInt(op.unixTimeStartMs!);
|
||||
const date = new Date();
|
||||
|
||||
@@ -478,9 +478,9 @@ const RetentionPolicyView = ({ policy }: { policy?: RetentionPolicy }) => {
|
||||
}}
|
||||
>
|
||||
<Radio.Button value={PolicyType.TimeBased}>
|
||||
Keep Duration
|
||||
By Time Period
|
||||
</Radio.Button>
|
||||
<Radio.Button value={PolicyType.CountBased}>Keep Last N</Radio.Button>
|
||||
<Radio.Button value={PolicyType.CountBased}>By Count</Radio.Button>
|
||||
</Radio.Group>
|
||||
</Form.Item>
|
||||
{elem}
|
||||
|
||||
Reference in New Issue
Block a user