feat: job list

This commit is contained in:
Samuel N Cui
2023-08-29 18:02:57 +08:00
parent cda9244e8e
commit 852cf8212e
80 changed files with 6173 additions and 1854 deletions
+1 -1
View File
@@ -12,7 +12,7 @@
*.out
# Dependency directories (remove the comment below to include it)
# vendor/
vendor/
output/
frontend/node_modules/
client/node_modules/
+4 -2
View File
@@ -6,10 +6,12 @@ import (
"github.com/abc950309/tapewriter/library"
)
// JobGet(context.Context, *entity.JobGetRequest) (*entity.JobGetReply, error)
var (
_ = entity.ServiceServer(&API{})
)
type API struct {
entity.UnimplementedServiceServer
entity.UnsafeServiceServer
lib *library.Library
exe *executor.Executor
+70
View File
@@ -0,0 +1,70 @@
package apis
import (
"fmt"
"io"
"net/http"
"runtime/debug"
"github.com/gin-gonic/gin"
"github.com/sirupsen/logrus"
)
func (api *API) Uploader() *gin.Engine {
r := gin.Default()
r.Use(func(ctx *gin.Context) {
defer func() {
err := recover()
if err == nil {
return
}
method := ctx.Request.Method
path := ctx.Request.URL.Path
status := 500
remoteAddr := ctx.Request.RemoteAddr
clientIP := ctx.ClientIP()
var e error
switch v := err.(type) {
case error:
e = v
default:
e = fmt.Errorf("%v", v)
}
logrus.WithContext(ctx).
WithError(e).WithField("stack", string(debug.Stack())).
Errorf(
"panic recover: method= %s path= %s status= %d remote_addr= %s client_ip= %s",
method, path, status, remoteAddr, clientIP,
)
reason := e.Error()
ctx.JSON(status, gin.H{"reason": reason})
ctx.Abort()
}()
ctx.Next()
})
r.GET("/ping", func(ctx *gin.Context) {
ctx.JSON(http.StatusOK, gin.H{"result": "pong"})
})
r.POST("/library/_import", func(ctx *gin.Context) {
logrus.WithContext(ctx).Infof("get library import request, %t %t", ctx == nil, ctx.Request == nil)
defer ctx.Request.Body.Close()
buf, err := io.ReadAll(ctx.Request.Body)
if err != nil {
panic(err)
}
if err := api.lib.Import(ctx, buf); err != nil {
panic(err)
}
ctx.JSON(http.StatusOK, gin.H{"result": "ok"})
})
return r
}
+1 -1
View File
@@ -9,7 +9,7 @@ import (
func (api *API) JobCreate(ctx context.Context, req *entity.JobCreateRequest) (*entity.JobCreateReply, error) {
job, err := api.exe.CreateJob(ctx, &executor.Job{
Status: entity.JobStatus_Pending,
Status: entity.JobStatus_PENDING,
Priority: req.Job.Priority,
}, req.Job.Param)
if err != nil {
+15
View File
@@ -0,0 +1,15 @@
package apis
import (
"context"
"github.com/abc950309/tapewriter/entity"
)
func (api *API) JobDelete(ctx context.Context, req *entity.JobDeleteRequest) (*entity.JobDeleteReply, error) {
if err := api.exe.DeleteJobs(ctx, req.Ids...); err != nil {
return nil, err
}
return &entity.JobDeleteReply{}, nil
}
+3
View File
@@ -4,16 +4,19 @@ import (
"context"
"github.com/abc950309/tapewriter/entity"
"github.com/sirupsen/logrus"
)
func (api *API) JobDisplay(ctx context.Context, req *entity.JobDisplayRequest) (*entity.JobDisplayReply, error) {
job, err := api.exe.GetJob(ctx, req.Id)
if err != nil {
logrus.WithContext(ctx).WithError(err).Infof("get job fail, job_id= %d", req.Id)
return &entity.JobDisplayReply{}, nil
}
result, err := api.exe.Display(ctx, job)
if err != nil {
logrus.WithContext(ctx).WithError(err).Infof("get job display fail, job_id= %d", req.Id)
return &entity.JobDisplayReply{}, nil
}
+16
View File
@@ -0,0 +1,16 @@
package apis
import (
"context"
"github.com/abc950309/tapewriter/entity"
)
func (api *API) LibraryExport(ctx context.Context, req *entity.LibraryExportRequest) (*entity.LibraryExportReply, error) {
buf, err := api.lib.Export(ctx, req.Types)
if err != nil {
return nil, err
}
return &entity.LibraryExportReply{Json: buf}, nil
}
+15
View File
@@ -0,0 +1,15 @@
package apis
import (
"context"
"github.com/abc950309/tapewriter/entity"
)
func (api *API) TapeDelete(ctx context.Context, req *entity.TapeDeleteRequest) (*entity.TapeDeleteReply, error) {
if err := api.lib.DeleteTapes(ctx, req.Ids...); err != nil {
return nil, err
}
return &entity.TapeDeleteReply{}, nil
}
-30
View File
@@ -1,30 +0,0 @@
package apis
import (
"context"
"github.com/abc950309/tapewriter/entity"
)
func (api *API) TapeMGet(ctx context.Context, req *entity.TapeMGetRequest) (*entity.TapeMGetReply, error) {
tapes, err := api.lib.MGetTape(ctx, req.Ids...)
if err != nil {
return nil, err
}
converted := make([]*entity.Tape, 0, len(tapes))
for _, tape := range tapes {
converted = append(converted, &entity.Tape{
Id: tape.ID,
Barcode: tape.Barcode,
Name: tape.Name,
Encryption: tape.Encryption,
CreateTime: tape.CreateTime.Unix(),
DestroyTime: convertOptionalTime(tape.DestroyTime),
CapacityBytes: tape.CapacityBytes,
WritenBytes: tape.WritenBytes,
})
}
return &entity.TapeMGetReply{Tapes: converted}, nil
}
+47
View File
@@ -0,0 +1,47 @@
package apis
import (
"context"
"fmt"
"github.com/abc950309/tapewriter/entity"
"github.com/abc950309/tapewriter/library"
"github.com/samber/lo"
)
func (api *API) TapeList(ctx context.Context, req *entity.TapeListRequest) (*entity.TapeListReply, error) {
tapes, err := func() ([]*library.Tape, error) {
switch v := req.GetParam().(type) {
case *entity.TapeListRequest_List:
return api.lib.ListTape(ctx, v.List)
case *entity.TapeListRequest_Mget:
m, err := api.lib.MGetTape(ctx, v.Mget.GetIds()...)
if err != nil {
return nil, err
}
return lo.Values(m), nil
default:
return nil, fmt.Errorf("unexpected list tape param, %T", req.GetParam())
}
}()
if err != nil {
return nil, err
}
converted := make([]*entity.Tape, 0, len(tapes))
for _, tape := range tapes {
converted = append(converted, &entity.Tape{
Id: tape.ID,
Barcode: tape.Barcode,
Name: tape.Name,
Encryption: tape.Encryption,
CreateTime: tape.CreateTime.Unix(),
DestroyTime: convertOptionalTime(tape.DestroyTime),
CapacityBytes: tape.CapacityBytes,
WritenBytes: tape.WritenBytes,
})
}
return &entity.TapeListReply{Tapes: converted}, nil
}
+3 -4
View File
@@ -1,14 +1,13 @@
#!/usr/bin/env bash
set -e;
set -ex;
CURDIR=$(cd $(dirname $0); pwd);
cd ${CURDIR};
rm -rf output;
mkdir -p output;
go build -o ./output/httpd ./cmd/tape-httpd;
go build -o ./output/loadtape ./cmd/tape-loadtape;
go build -o ./output/import ./cmd/tape-import;
go build -mod=vendor -o ./output/httpd ./cmd/tape-httpd;
go build -mod=vendor -o ./output/lto-info ./cmd/lto-info;
cp -r scripts ./output/;
cp -r ./frontend/dist ./output/frontend;
+490
View File
@@ -0,0 +1,490 @@
package main
// vim: ts=4:sts=4:
import (
"fmt"
"strings"
"time"
)
const (
TYPE_BINARY = 0x00
TYPE_ASCII = 0x01
READ_ATT_REPLY_LEN = 512
WRITE_ATT_CMD_LEN = 16
)
type CmAttr struct {
IsValid bool
Name string
Command int
Len int
DataType int
DataInt uint64
DataStr string
NoTrim bool
MockInt uint64
MockStr string
}
type Cm struct {
PartCapRemain *CmAttr //
PartCapMax *CmAttr //
TapeAlertFlags *CmAttr
LoadCount *CmAttr //
MAMSpaceRemaining *CmAttr
AssigningOrganization *CmAttr //
FormattedDensityCode *CmAttr //
InitializationCount *CmAttr //err
Identifier *CmAttr //err
VolumeChangeReference *CmAttr //err
DeviceAtLoadN0 *CmAttr //
DeviceAtLoadN1 *CmAttr //
DeviceAtLoadN2 *CmAttr //
DeviceAtLoadN3 *CmAttr //
TotalWritten *CmAttr //
TotalRead *CmAttr //
TotalWrittenSession *CmAttr //
TotalReadSession *CmAttr //
LogicalPosFirstEncrypted *CmAttr //err
LogicalPosFirstUnencrypted *CmAttr //err
UsageHistory *CmAttr
PartUsageHistory *CmAttr
Manufacturer *CmAttr //
SerialNo *CmAttr //
Length *CmAttr //
Width *CmAttr //
AssigningOrg *CmAttr //
MediumDensity *CmAttr //
ManufactureDate *CmAttr //
MAMCapacity *CmAttr //
Type *CmAttr //
TypeInformation *CmAttr //
UserText *CmAttr
DateTimeLastWritten *CmAttr //err
TextLocalizationId *CmAttr //err
Barcode *CmAttr //err
OwningHostTextualName *CmAttr //err
MediaPool *CmAttr //err
ApplicationFormatVersion *CmAttr //err
MediumGloballyUniqId *CmAttr //err
MediaPoolGloballyUniqId *CmAttr //err
}
type SpecsType struct {
IsValid bool
NativeCap int
CompressedCap int
NativeSpeed int
CompressedSpeed int
FullTapeMinutes int
CompressFactor string
CanWORM bool
CanEncrypt bool
PartitionNumber int
BandsPerTape int
WrapsPerBand int
TracksPerWrap int
}
func min2human(min int) string {
if min < 60 {
return fmt.Sprintf("%d min", min)
}
return fmt.Sprintf("%dh%d", min/60, min-60*(min/60))
}
// https://github.com/hreinecke/sg3_utils/issues/18
func cmDensityFriendly(d int) (string, SpecsType) {
friendlyName := "Unknown"
var specs SpecsType
switch d {
case 0x40:
friendlyName = "LTO-1"
specs = SpecsType{true, 100, 200, 20, 40, 60 + 23, "2:1", false, false, 1, 4, 12, 8}
case 0x42:
friendlyName = "LTO-2"
specs = SpecsType{true, 200, 400, 40, 80, 60 + 23, "2:1", false, false, 1, 4, 16, 8}
case 0x44:
friendlyName = "LTO-3"
specs = SpecsType{true, 400, 800, 80, 160, 60 + 23, "2:1", true, false, 1, 4, 11, 16}
case 0x46:
friendlyName = "LTO-4"
specs = SpecsType{true, 800, 1600, 120, 240, 60 + 51, "2:1", true, true, 1, 4, 14, 16}
case 0x58:
friendlyName = "LTO-5"
specs = SpecsType{true, 1500, 3000, 140, 280, 60*3 + 10, "2:1", true, true, 2, 4, 20, 16}
case 0x5A:
friendlyName = "LTO-6"
specs = SpecsType{true, 2500, 6250, 160, 400, 60*4 + 20, "2.5:1", true, true, 4, 4, 34, 16}
case 0x5C:
friendlyName = "LTO-7"
specs = SpecsType{true, 6000, 15000, 300, 750, 60*5 + 33, "2.5:1", true, true, 4, 4, 28, 32}
case 0x5D:
friendlyName = "LTO-M8"
specs = SpecsType{true, 9000, 22500, 300, 750, 60*8 + 20, "2.5:1", false, true, 4, 4, 42, 32}
case 0x5E:
friendlyName = "LTO-8"
specs = SpecsType{true, 12000, 30000, 360, 900, 60*9 + 16, "2.5:1", true, true, 4, 4, 52, 32}
case 0x60: /* guessed, to check FIXME */
friendlyName = "LTO-9"
specs = SpecsType{true, 18000, 45000, 400, 1000, 60*12 + 30, "2.5:1", true, true, 4, 0, 0, 0} /* FIXME */
}
return friendlyName, specs
}
func (cm *Cm) String() string {
s := "Medium information:\n"
if cm.Type.IsValid {
friendlyName := "Unknown"
switch cm.Type.DataInt {
case 0x00:
friendlyName = "Data cartridge"
case 0x01:
friendlyName = "Cleaning cartridge"
if cm.TypeInformation.IsValid {
friendlyName = fmt.Sprintf("%s (%d cycles max)", friendlyName, cm.TypeInformation.DataInt)
}
case 0x80:
friendlyName = "WORM (Write-once) cartridge"
}
s += fmt.Sprintf(" Cartridge Type: 0x%02x - %s\n", cm.Type.DataInt, friendlyName)
}
var specs SpecsType
specs.IsValid = false
if cm.MediumDensity.IsValid {
var s1 string
s1, specs = cmDensityFriendly(int(cm.MediumDensity.DataInt))
s += fmt.Sprintf(" Medium format : 0x%02x - %s\n", cm.MediumDensity.DataInt, s1)
s2, _ := cmDensityFriendly(int(cm.FormattedDensityCode.DataInt))
s += fmt.Sprintf(" Formatted as : 0x%02x - %s\n", cm.FormattedDensityCode.DataInt, s2)
}
if cm.Barcode.IsValid {
s += fmt.Sprintf(" Barcode : %s\n", cm.Barcode.DataStr)
}
if cm.AssigningOrg.IsValid {
s += fmt.Sprintf(" Assign. Org. : %s\n", cm.AssigningOrg.DataStr)
}
if cm.Manufacturer.IsValid {
s += fmt.Sprintf(" Manufacturer : %s\n", cm.Manufacturer.DataStr)
}
if cm.SerialNo.IsValid {
s += fmt.Sprintf(" Serial No : %s\n", cm.SerialNo.DataStr)
}
if cm.ManufactureDate.IsValid {
if len(cm.ManufactureDate.DataStr) == 8 {
// YYYYMMDD
if d, err := time.Parse("20060102", cm.ManufactureDate.DataStr); err == nil {
years := time.Since(d).Hours() / 24.0 / 365.0
s += fmt.Sprintf(" Manuf. Date : %s-%s-%s (roughly %.1f years ago)\n", cm.ManufactureDate.DataStr[0:4], cm.ManufactureDate.DataStr[4:6], cm.ManufactureDate.DataStr[6:8], years)
} else {
s += fmt.Sprintf(" Manuf. Date : %s-%s-%s\n", cm.ManufactureDate.DataStr[0:4], cm.ManufactureDate.DataStr[4:6], cm.ManufactureDate.DataStr[6:8])
}
} else {
s += fmt.Sprintf(" Manuf. Date : %s\n", cm.ManufactureDate.DataStr)
}
}
if cm.Length.IsValid {
s += fmt.Sprintf(" Tape length : %d meters\n", cm.Length.DataInt)
}
if cm.Width.IsValid {
s += fmt.Sprintf(" Tape width : %.1f mm\n", float32(cm.Width.DataInt)/10)
}
if cm.MAMCapacity.IsValid {
if cm.MAMSpaceRemaining.IsValid {
s += fmt.Sprintf(" MAM Capacity : %d bytes (%d bytes remaining)\n", cm.MAMCapacity.DataInt, cm.MAMSpaceRemaining.DataInt)
} else {
s += fmt.Sprintf(" MAM Capacity : %d bytes\n", cm.MAMCapacity.DataInt)
}
}
if specs.IsValid {
s += fmt.Sprintf("Format specs:\n")
s += fmt.Sprintf(" Capacity : %5d GB native - %5d GB compressed with a %s ratio\n", specs.NativeCap, specs.CompressedCap, specs.CompressFactor)
s += fmt.Sprintf(" R/W Speed : %5d MB/s native - %5d MB/s compressed\n", specs.NativeSpeed, specs.CompressedSpeed)
s += fmt.Sprintf(" Partitions: %5d max partitions supported\n", specs.PartitionNumber)
s += fmt.Sprintf(" Phy. specs: %d bands/tape, %d wraps/band, %d tracks/wrap, %d total tracks\n", specs.BandsPerTape, specs.WrapsPerBand, specs.TracksPerWrap, specs.BandsPerTape*specs.WrapsPerBand*specs.TracksPerWrap)
s += fmt.Sprintf(" Duration : %s to fill tape with %d end-to-end passes (%.0f seconds/pass)\n", min2human(specs.FullTapeMinutes), specs.BandsPerTape*specs.WrapsPerBand, float64(specs.FullTapeMinutes)*60.0/float64(specs.BandsPerTape*specs.WrapsPerBand))
}
s += fmt.Sprintf("Usage information:\n")
if cm.PartCapRemain.IsValid && cm.PartCapMax.IsValid {
r := cm.PartCapRemain.DataInt
m := cm.PartCapMax.DataInt
if m > 0 {
s += fmt.Sprintf(" Partition space free : %d%% (%d/%d MiB, %d/%d GiB, %.2f/%.2f TiB)\n", 100*r/m, r, m, r/1024, m/1024, float32(r)/1024/1024, float32(m)/1024/1024)
} else {
s += fmt.Sprintf(" Partition space free : ?%% (%d/%d MiB, %d/%d GiB, %.2f/%.2f TiB)\n", r, m, r/1024, m/1024, float32(r)/1024/1024, float32(m)/1024/1024)
}
}
if cm.LoadCount.IsValid {
s += fmt.Sprintf(" Cartridge load count : %d\n", cm.LoadCount.DataInt)
}
if cm.TotalWritten.IsValid && cm.TotalRead.IsValid {
s += fmt.Sprintf(" Data written - alltime: %12d MiB (%9.2f GiB, %6.2f TiB", cm.TotalWritten.DataInt, float64(cm.TotalWritten.DataInt)/1024, float64(cm.TotalWritten.DataInt)/1024/1024)
if cm.PartCapMax.IsValid {
s += fmt.Sprintf(", %.2f FVE", float64(cm.TotalWritten.DataInt)/float64(cm.PartCapMax.DataInt))
}
s += fmt.Sprintf(")\n")
s += fmt.Sprintf(" Data read - alltime: %12d MiB (%9.2f GiB, %6.2f TiB", cm.TotalRead.DataInt, float64(cm.TotalRead.DataInt)/1024, float64(cm.TotalRead.DataInt)/1024/1024)
if cm.PartCapMax.IsValid {
s += fmt.Sprintf(", %.2f FVE", float64(cm.TotalRead.DataInt)/float64(cm.PartCapMax.DataInt))
}
s += fmt.Sprintf(")\n")
}
if cm.TotalWrittenSession.IsValid && cm.TotalReadSession.IsValid {
s += fmt.Sprintf(" Data written - session: %12d MiB (%9.2f GiB, %6.2f TiB", cm.TotalWrittenSession.DataInt, float64(cm.TotalWrittenSession.DataInt)/1024, float64(cm.TotalWrittenSession.DataInt)/1024/1024)
if cm.PartCapMax.IsValid {
s += fmt.Sprintf(", %.2f FVE", float64(cm.TotalWrittenSession.DataInt)/float64(cm.PartCapMax.DataInt))
}
s += fmt.Sprintf(")\n")
s += fmt.Sprintf(" Data read - session: %12d MiB (%9.2f GiB, %6.2f TiB", cm.TotalReadSession.DataInt, float64(cm.TotalReadSession.DataInt)/1024, float64(cm.TotalReadSession.DataInt)/1024/1024)
if cm.PartCapMax.IsValid {
s += fmt.Sprintf(", %.2f FVE", float64(cm.TotalReadSession.DataInt)/float64(cm.PartCapMax.DataInt))
}
s += fmt.Sprintf(")\n")
}
s += fmt.Sprintf("Previous sessions:\n")
for i, load := range []*CmAttr{cm.DeviceAtLoadN0, cm.DeviceAtLoadN1, cm.DeviceAtLoadN2, cm.DeviceAtLoadN3} {
if load.IsValid {
var devname, serial string
if len(load.DataStr) > 8 {
devname = strings.Trim(load.DataStr[:8], " \u0000")
serial = strings.Trim(load.DataStr[8:], " \u0000")
} else {
devname = strings.Trim(load.DataStr, " \u0000")
}
if serial != "" {
s += fmt.Sprintf(" Session N-%d: Used in a device of vendor %s (serial %s)\n", i, devname, serial)
} else {
s += fmt.Sprintf(" Session N-%d: Used in a device of vendor %s\n", i, devname)
}
}
}
//s += fmt.Sprintf("Medium Usage History:\n")
return s
}
func CmAttrNew(name string, command int, length int, datatype int, mock interface{}) *CmAttr {
cmAttr := &CmAttr{
Name: name,
Command: command,
Len: length,
DataType: datatype,
}
switch mock.(type) {
case string:
cmAttr.MockStr = mock.(string)
default:
cmAttr.MockInt = uint64(mock.(int))
}
return cmAttr
}
func CmNew() *Cm {
return &Cm{
PartCapRemain: CmAttrNew(
"Remaining capacity in partition (MiB)",
0x0000, 8, TYPE_BINARY, 198423,
),
PartCapMax: CmAttrNew(
"Maximum capacity in partition (MiB)",
0x0001, 8, TYPE_BINARY, 200448,
),
TapeAlertFlags: CmAttrNew(
"Tape alert flags",
0x0002, 8, TYPE_BINARY, 0,
),
LoadCount: CmAttrNew(
"Load count",
0x0003, 8, TYPE_BINARY, 42,
),
MAMSpaceRemaining: CmAttrNew(
"MAM space remaining (bytes)",
0x0004, 8, TYPE_BINARY, 850,
),
AssigningOrganization: CmAttrNew(
"Assigning organization",
0x0005, 8, TYPE_ASCII, "LTO-FAKE",
),
FormattedDensityCode: CmAttrNew(
"Formatted density code",
0x0006, 1, TYPE_BINARY, 66,
),
InitializationCount: CmAttrNew(
"Initialization count",
0x0007, 2, TYPE_BINARY, "err",
),
Identifier: CmAttrNew(
"Identifier (deprecated)",
0x0008, 32, TYPE_ASCII, "err",
),
VolumeChangeReference: CmAttrNew(
"Volume change reference",
0x0009, 4, TYPE_BINARY, "err",
),
DeviceAtLoadN0: CmAttrNew(
"Device Vendor/Serial at current load",
0x020A, 40, TYPE_ASCII, "FAKEVENDMODEL012345678901234567890123456",
),
DeviceAtLoadN1: CmAttrNew(
"Device Vendor/Serial at load N-1",
0x020B, 40, TYPE_ASCII, "FAKEVEND MODEL12345",
),
DeviceAtLoadN2: CmAttrNew(
"Device Vendor/Serial at load N-2",
0x020C, 40, TYPE_ASCII, "ACMEINC \u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000",
),
DeviceAtLoadN3: CmAttrNew(
"Device Vendor/Serial at load N-3",
0x020D, 40, TYPE_ASCII, "FAKEVEND MODEL34567",
),
TotalWritten: CmAttrNew(
"Total MiB written",
0x0220, 8, TYPE_BINARY, 17476,
),
TotalRead: CmAttrNew(
"Total MiB read",
0x0221, 8, TYPE_BINARY, 15827,
),
TotalWrittenSession: CmAttrNew(
"Total MiB written in current load",
0x0222, 8, TYPE_BINARY, 0,
),
TotalReadSession: CmAttrNew(
"Total MiB Read in current load",
0x0223, 8, TYPE_BINARY, 139,
),
LogicalPosFirstEncrypted: CmAttrNew(
"Logical pos. of 1st encrypted block",
0x0224, 8, TYPE_BINARY, "err",
),
LogicalPosFirstUnencrypted: CmAttrNew(
"Logical pos. of 1st unencrypted block after 1st encrypted block",
0x0225, 8, TYPE_BINARY, "err",
),
UsageHistory: CmAttrNew(
"Medium Usage History",
0x0340, 90, TYPE_BINARY, "err",
),
PartUsageHistory: CmAttrNew(
"Partition Usage History",
0x0341, 90, TYPE_BINARY, "err",
),
Manufacturer: CmAttrNew(
"Manufacturer",
0x0400, 8, TYPE_ASCII, "FAKMANUF",
),
SerialNo: CmAttrNew(
"Serial No",
0x0401, 32, TYPE_ASCII, "123456789",
),
Length: CmAttrNew(
"Tape length",
0x0402, 4, TYPE_BINARY, 999,
),
Width: CmAttrNew(
"Tape width",
0x0403, 4, TYPE_BINARY, 111,
),
AssigningOrg: CmAttrNew(
"Assigning Organization",
0x0404, 8, TYPE_ASCII, "LTO-FAKE",
),
MediumDensity: CmAttrNew(
"Medium density code",
0x0405, 1, TYPE_BINARY, 0x42,
),
ManufactureDate: CmAttrNew(
"Manufacture Date",
0x0406, 8, TYPE_ASCII, "20191231",
),
MAMCapacity: CmAttrNew(
"MAM Capacity",
0x0407, 8, TYPE_BINARY, 4096,
),
Type: CmAttrNew(
"Type",
0x0408, 1, TYPE_BINARY, 1,
),
TypeInformation: CmAttrNew(
"Type Information",
0x0409, 2, TYPE_BINARY, 50,
),
/*
CmAttr{
Name: "Application Vendor",
Command: 0x0800,
Len: 8,
DataType: TYPE_ASCII,
},
CmAttr{
Name: "Application Name",
Command: 0x0801,
Len: 32,
DataType: TYPE_ASCII,
},
CmAttr{
Name: "Application Version",
Command: 0x0802,
Len: 8,
DataType: TYPE_ASCII,
},
*/
UserText: CmAttrNew(
"User Medium Text Label",
0x0803, 160, TYPE_ASCII, "User Label",
//NoTrim: tr)e,
),
DateTimeLastWritten: CmAttrNew(
"Date and Time Last Written",
0x0804, 12, TYPE_ASCII, "err",
),
TextLocalizationId: CmAttrNew(
"Text Localization Identifier",
0x0805, 1, TYPE_BINARY, "err",
),
Barcode: CmAttrNew(
"Barcode",
0x0806, 12, TYPE_ASCII, "err",
),
OwningHostTextualName: CmAttrNew(
"Owning Host Textual Name",
0x0807, 80, TYPE_ASCII, "err",
),
MediaPool: CmAttrNew(
"Media Pool",
0x0808, 160, TYPE_ASCII, "err",
),
ApplicationFormatVersion: CmAttrNew(
"Application Format Version",
0x080B, 16, TYPE_ASCII, "err",
),
MediumGloballyUniqId: CmAttrNew(
"Medium Globally Unique Identifier",
0x0820, 36, TYPE_ASCII, "err",
),
MediaPoolGloballyUniqId: CmAttrNew(
"Media Pool Globally Unique Identifier",
0x0821, 36, TYPE_ASCII, "err",
),
}
}
BIN
View File
Binary file not shown.
+106
View File
@@ -0,0 +1,106 @@
package main
// vim: ts=4:sts=4
import (
"errors"
"fmt"
"os"
"time"
flags "github.com/jessevdk/go-flags"
)
type OptionsStruct struct {
Device string `short:"f" long:"device" value-name:"DEV" description:"Tape device (default: /dev/nst0, or TAPE envvar)"`
Mock bool `long:"mock" description:"Use a mocked tape drive (for tests only)"`
Debug bool `short:"d" long:"debug" description:"Print debug information"`
Dump string `long:"dump" value-name:"FILE" description:"Dump SCSI raw data to a file"`
Man bool `hidden:"1" long:"man"`
}
func main() {
var err error
options := &OptionsStruct{}
parser := flags.NewParser(options, flags.Default)
_, err = parser.Parse()
if err != nil {
os.Exit(1)
}
if options.Man {
fmt.Println("man")
parser.WriteManPage(os.Stdout)
return
}
var drive *TapeDrive
syncerr := make(chan error)
go func() {
if options.Mock {
drive, err = TapeDriveNewFake()
} else {
drive, err = TapeDriveNew(options.Device)
}
syncerr <- err
}()
openerr := errors.New("timeout")
started := time.Now()
waitupto := started.Add(time.Second * 20)
lastprint := started
waitfor:
for waitupto.After(time.Now()) && openerr != nil {
select {
case openerr = <-syncerr:
if openerr != nil {
fmt.Println("Failed")
os.Exit(1)
} else {
// openerr
break waitfor
}
default:
if time.Since(lastprint) > time.Second {
fmt.Printf("Still trying to open the device, aborting in %s...\n", time.Until(waitupto).Round(time.Second))
lastprint = time.Now()
}
}
time.Sleep(10 * time.Millisecond)
}
if openerr != nil {
fmt.Println("Timed out opening device, is a tape inserted?")
os.Exit(1)
} else {
fmt.Printf("Device %s opened\n", drive.DeviceName)
}
if options.Dump != "" {
drive.SetDumpFile(options.Dump)
}
/*
poh := &LogSenseType{0x3C, 0x0008}
err = scsiLogSense(dev, poh)
if err != nil {
fmt.Println("logtest:",err)
/ }
*/
//fmt.Println("Inquiry")
/*err =*/
drive.ScsiInquiry()
//fmt.Println("Inquiry err:")
//fmt.Println(err)
drive.GetStatus()
drive.GetAttributes()
fmt.Println("")
//fmt.Printf("\r \r")
//drive.CmList.Print()
fmt.Println(drive)
}
+502
View File
@@ -0,0 +1,502 @@
package main
// vim: ts=4:sts=4:
import (
"bytes"
//"encoding/json"
"errors"
"fmt"
"os"
"strings"
"syscall"
"unsafe"
"github.com/HewlettPackard/structex"
"github.com/benmcclelland/mtio"
"github.com/benmcclelland/sgio"
"github.com/modern-go/reflect2"
)
/*
type TapeDriveInterface interface {
Open() error
SetUserLabel(string) error
GetAttribute(*CmAttr) error
}
*/
type InquiryInfoType struct {
Vendor string
Model string
Firmware string
}
type TapeDrive struct {
DeviceName string
Dev *os.File
CmList *Cm
InquiryInfo InquiryInfoType
dumpFd *os.File
}
func TapeDriveNewDefault() (*TapeDrive, error) {
return TapeDriveNew("")
}
func TapeDriveNewFake() (*TapeDrive, error) {
return TapeDriveNew("FAKE")
}
func (drive TapeDrive) IsFake() bool {
return drive.DeviceName == "FAKE"
}
// copy of sg.OpenScsiDevice() but with RDONLY instead of O_RDWR
func OpenScsiDeviceRO(fname string) (*os.File, error) {
f, err := os.OpenFile(fname, os.O_RDONLY, 0)
if err != nil {
return nil, err
}
var version uint32
_, _, errno := syscall.Syscall(
syscall.SYS_IOCTL,
uintptr(f.Fd()),
uintptr(sgio.SG_GET_VERSION_NUM),
uintptr(unsafe.Pointer(&version)),
)
if errno != 0 {
return nil, fmt.Errorf("failed to get version info from sg device (errno=%d)", errno)
}
if version < 30000 {
return nil, fmt.Errorf("device does not appear to be an sg device")
}
return f, nil
}
func TapeDriveNew(devicename string) (*TapeDrive, error) {
if devicename == "" {
if os.Getenv("TAPE") != "" {
devicename = os.Getenv("TAPE")
} else {
devicename = "/dev/nst0"
}
}
drive := &TapeDrive{DeviceName: devicename, CmList: CmNew()}
if drive.IsFake() {
fmt.Println("Will use a fake tape drive")
return drive, nil
}
fmt.Printf("Opening device %s\n", devicename)
dev, err := OpenScsiDeviceRO(devicename)
if err != nil {
fmt.Println("Failed to open:", err)
return nil, err
}
fmt.Println("Checking whether device is ready")
err = sgio.TestUnitReady(dev)
if err != nil {
fmt.Println("Unit is not ready:", err)
return nil, err
}
fmt.Println("Unit is ready")
drive.Dev = dev
return drive, nil
}
func (drive *TapeDrive) GetStatus() error {
// http://manpages.ubuntu.com/manpages/focal/man4/st.4.html
mtget, _ := mtio.GetStatus(drive.Dev)
fmt.Println(mtget)
//blocksz := uint32(mtget.DsReg) & 0x00FFFFFF
//density := (uint32(mtget.DsReg) & 0xFF000000) >> 24
//fmt.Printf("blocksz=%d density=%x\n", blocksz, density)
//fmt.Println(mtio.GetPos(drive.Dev))
return nil
}
func (drive *TapeDrive) SetDumpFile(file string) error {
if drive.dumpFd != nil {
drive.dumpFd.Close()
}
fo, err := os.Create(file)
if err != nil {
panic(err)
}
drive.dumpFd = fo
return nil
}
func (drive *TapeDrive) SetUserLabel(str string) error {
senseBuf := make([]byte, sgio.SENSE_BUF_LEN)
inqCmdBlk := []uint8{0x8D, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 169, 0, 0}
wrAtt := make([]byte, 169)
wrAtt[0] = 0
wrAtt[1] = 0
wrAtt[2] = 0
wrAtt[3] = 165
wrAtt[4] = 0x08
wrAtt[5] = 0x03
wrAtt[6] = 2
wrAtt[7] = 0
wrAtt[8] = 160
for i := 0; i < 160; i++ {
if i < len(str) {
wrAtt[9+i] = str[i]
} else {
wrAtt[9+i] = 0
}
}
ioHdr := &sgio.SgIoHdr{
InterfaceID: int32('S'),
CmdLen: uint8(len(inqCmdBlk)),
MxSbLen: sgio.SENSE_BUF_LEN,
DxferDirection: sgio.SG_DXFER_TO_DEV,
DxferLen: uint32(len(wrAtt)),
Dxferp: &wrAtt[0],
Cmdp: &inqCmdBlk[0],
Sbp: &senseBuf[0],
Timeout: sgio.TIMEOUT_20_SECS,
}
err := sgio.SgioSyscall(drive.Dev, ioHdr)
if err != nil {
return err
}
err = sgio.CheckSense(ioHdr, &senseBuf)
if err != nil {
return err
}
return nil
}
func (drive *TapeDrive) GetAttributes() error {
typ := reflect2.TypeOfPtr(drive.CmList).Elem().(reflect2.StructType)
for i := 0; i < typ.NumField(); i++ {
attrPtr := typ.Field(i).Get(drive.CmList).(**CmAttr)
attr := *attrPtr
drive.GetAttribute(attr)
}
return nil
}
func (drive *TapeDrive) GetAttribute(attr *CmAttr) error {
if drive == nil {
return errors.New("drive is nil")
}
senseBuf := make([]byte, sgio.SENSE_BUF_LEN)
replyBuf := make([]byte, READ_ATT_REPLY_LEN)
/* READ ATTRIBUTE (8Ch)
bits: 7 | 6 | 5 | 4 | 3 | 2 | 1 | 0
byte0: --- OPERATION CODE (8Ch) ----
byte1: reserved | SERVICE ACTION
byte2: obsolete
byte3: obsolete
byte4: obsolete
byte5: LOGICAL VOLUME NUMBER
byte6: reserved
byte7: PARTITION NUMBER
byte8: (MSB) <-- FIRST ATTRIBUTE
byte9: IDENTIFIER --> (LSB)
byte10: (MSB) <-- ALLOCATION
byte11:
byte12:
byte13: LENGTH --> (LSB)
byte14: reserved | CACHE
byte15: CONTROL BYTE (00h)
*/
inqCmdBlk := []uint8{0x8C, 0, 0, 0, 0, 0, 0, 0, 0x04, 0x00, 0, 0, 159, 0, 0, 0}
inqCmdBlk[8] = uint8(0xff & (attr.Command >> 8))
inqCmdBlk[9] = uint8(0xff & attr.Command)
inqCmdBlk[12] = uint8(0xff & attr.Len)
ioHdr := &sgio.SgIoHdr{
InterfaceID: int32('S'),
CmdLen: uint8(len(inqCmdBlk)),
MxSbLen: sgio.SENSE_BUF_LEN,
DxferDirection: sgio.SG_DXFER_FROM_DEV,
DxferLen: READ_ATT_REPLY_LEN,
Dxferp: &replyBuf[0],
Cmdp: &inqCmdBlk[0],
Sbp: &senseBuf[0],
Timeout: sgio.TIMEOUT_20_SECS,
}
if drive.IsFake() {
if attr.MockStr == "err" {
attr.IsValid = false
return errors.New("mocked error")
}
if attr.DataType == TYPE_BINARY {
attr.DataInt = attr.MockInt
attr.IsValid = true
return nil
}
if attr.DataType == TYPE_ASCII {
attr.DataStr = attr.MockStr
attr.IsValid = true
return nil
}
return errors.New("Invalid type")
}
attr.IsValid = false
err := sgio.SgioSyscall(drive.Dev, ioHdr)
if drive.dumpFd != nil {
senserr := sgio.CheckSense(ioHdr, &senseBuf)
senstr := "<nil>"
if senserr != nil {
senstr = strings.Replace(senserr.Error(), "\n", " ", -1)
}
drive.dumpFd.Write([]byte(fmt.Sprintf("GetAttribute[%s]:\nsyscallerr: %v\nsenserr: %v\ncommand: 0x%04x\ninqCmdBlk: %v\nsenseBuf: %v\nreplyBuf: %v\n\n", attr.Name, err, senstr, attr.Command, inqCmdBlk, senseBuf, replyBuf)))
}
if err != nil {
return err
}
err = sgio.CheckSense(ioHdr, &senseBuf)
if err != nil {
return err
}
if attr.DataType == TYPE_BINARY {
attr.DataInt = 0
for i := 0; i < attr.Len; i++ {
attr.DataInt *= 256
attr.DataInt += uint64(replyBuf[9+i])
}
attr.IsValid = true
return nil
}
if attr.DataType == TYPE_ASCII {
attr.DataStr = string(replyBuf[9:(9 + attr.Len)])
if !attr.NoTrim {
attr.DataStr = strings.TrimRight(attr.DataStr, " ")
}
attr.IsValid = true
return nil
}
return errors.New("Invalid type")
}
type SCSI_Inquiry_Cmd struct {
OpCode uint8
EVPD uint8 `bitfield:"1"`
reserved0 uint8 `bitfield:"4,reserved"`
obsolete0 uint8 `bitfield:"3,reserved"`
PageCode uint8
AllocationLength uint16
ControlByte uint8
}
type SCSI_Drive_Serial_Numbers_Return struct {
PeripheralDeviceType uint8 `bitfield:"5"` // Byte 0
PeripheralQualifier uint8 `bitfield:"3"`
PageCode uint8 // Byte 1
reserved0 uint8 `bitfield:"8,reserved"` // Byte 2
PageLength uint8
ManufSN [12]byte
ReportedSN [12]byte
}
type SCSI_Inquiry_Return struct {
PeripheralDeviceType uint8 `bitfield:"5"` // Byte 0
PeripheralQualifier uint8 `bitfield:"3"`
Reserved0 uint8
Version uint8
ReponseDataFormat uint8 `bitfield:"4"`
HiSup uint8 `bitfield:"1"`
NACA uint8 `bitfield:"1"`
Obsolete0 uint8 `bitfield:"1"`
Obsolete1 uint8 `bitfield:"1"`
AdditionalLen uint8
Protect uint8 `bitfield:"1"`
Reserved1 uint8 `bitfield:"2"`
ThreePC uint8 `bitfield:"1"`
TPGS uint8 `bitfield:"2"`
ACC uint8 `bitfield:"1"`
SCCS uint8 `bitfield:"1"`
Osef0 uint8
Osef1 uint8
VendorID [8]byte
ProductID [16]byte
ProductRevision [4]byte // YMDV(F63D), Y=15 M=6 D=3 V=D
Reserved2 uint8
Obsolete2 uint8
MaxSpeed uint8 `bitfield:"4"`
ProtocolID uint8 `bitfield:"4"`
FIPS uint8 `bitfield:"2"`
Reserved3 uint8 `bitfield:"5"`
Restricted uint8 `bitfield:"1"`
Reserved4 uint8
OEMSpecific uint8
OEMSpecificSubfield uint8
Reserved5 uint8
Reserved6 uint32
PartNumber [8]byte
Reserved7 uint8
Reserved8 uint8
Truc1 uint16
Truc2 uint16
Truc3 uint16
Truc4 uint16
Truc5 uint16
Truc6 uint16
}
func (drive *TapeDrive) ScsiInquiry() error {
senseBuf := make([]byte, sgio.SENSE_BUF_LEN)
replyBuf := make([]byte, 0xFF)
inqCmdBlk := []uint8{0x12, 0, 0, 0, 0xFF, 0}
ioHdr := &sgio.SgIoHdr{
InterfaceID: int32('S'),
CmdLen: uint8(len(inqCmdBlk)),
MxSbLen: sgio.SENSE_BUF_LEN,
DxferDirection: sgio.SG_DXFER_FROM_DEV,
DxferLen: 0xFF,
Dxferp: &replyBuf[0],
Cmdp: &inqCmdBlk[0],
Sbp: &senseBuf[0],
Timeout: sgio.TIMEOUT_20_SECS,
}
if !drive.IsFake() {
err := sgio.SgioSyscall(drive.Dev, ioHdr)
if drive.dumpFd != nil {
senserr := sgio.CheckSense(ioHdr, &senseBuf)
senstr := "<nil>"
if senserr != nil {
senstr = strings.Replace(senserr.Error(), "\n", " ", -1)
}
drive.dumpFd.Write([]byte(fmt.Sprintf("ScsiInquiry:\nsyscallerr: %v\nsenserr: %v\ninqCmdBlk: %v\nsenseBuf: %v\nreplyBuf: %v\n\n", err, senstr, inqCmdBlk, senseBuf, replyBuf)))
}
if err != nil {
return err
}
err = sgio.CheckSense(ioHdr, &senseBuf)
if err != nil {
return err
}
} else {
replyBuf = []byte{1, 128, 3, 2, 91, 0, 1, 48, 72, 80, 32, 32, 32, 32, 32, 32, 85, 108, 116, 114, 105, 117, 109, 32, 50, 45, 83, 67, 83, 73, 32, 32, 70, 54, 51, 68, 0, 0, 0, 0, 0, 12, 0, 36, 68, 82, 45, 49, 48, 0, 0, 0, 0, 0, 0, 0, 12, 0, 0, 84, 11, 28, 2, 119, 2, 28, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}
}
//fmt.Println(replyBuf)
var parsed = new(SCSI_Inquiry_Return)
if err := structex.Decode(bytes.NewReader(replyBuf), parsed); err != nil {
fmt.Println("structex failed:", err)
}
drive.InquiryInfo.Vendor = strings.Trim(string(parsed.VendorID[:]), " \u0000")
drive.InquiryInfo.Model = strings.Trim(string(parsed.ProductID[:]), " \u0000")
drive.InquiryInfo.Firmware = strings.Trim(string(parsed.ProductRevision[:]), " \u0000")
//fmt.Printf("MaxSpeed=%d ProtoID=%d OEMSpec=%d OEMSpecSub=%d PartNu=<%s>\n", parsed.MaxSpeed, parsed.ProtocolID, parsed.OEMSpecific, parsed.OEMSpecificSubfield, parsed.PartNumber)
//fmt.Printf("Truc1=%04x Truc2=%04x Truc3=%04x Truc4=%04x Truc5=%04x Truc6=%04x\n", parsed.Truc1, parsed.Truc2, parsed.Truc3, parsed.Truc4, parsed.Truc5, parsed.Truc6)
return nil
}
type LogSenseType struct {
PageCode uint8
SubPageCode uint8
}
func (drive *TapeDrive) scsiLogSense(ls *LogSenseType) error {
senseBuf := make([]byte, sgio.SENSE_BUF_LEN)
replyBuf := make([]byte, READ_ATT_REPLY_LEN)
/* LOG SENSE (4Dh)
bits: 7 | 6 | 5 | 4 | 3 | 2 | 1 | 0
byte0: --- OPERATION CODE (4Dh) ----
byte1: reserved |PPC|SP
byte2: PC | PAGE CODE
byte3: SUBPAGE CODE
byte4: reserved
byte5: <-- (MSB) PARAMETER..........
byte6: ............POINTER (LSB) -->
byte7: <-- (MSB) ALLOCATION.........
byte8: .............LENGTH (LSB) -->
byte9: CONTROL BYTE (00h)
The log values returned are controlled by the Page Control ( PC ) field value as follows:
Value Description
00b the maximum value for each log entry is returned.
01b the current values are returned.
10b the maximum value for each log entry is returned.
11b the power-on values are returned.
NOTE 10 - For page 2Eh (TapeAlert) only, the PC field is ignored. Current values are always returned.
The Parameter Pointer Control ( PPC ) must be set to 0. Returning changed parameters is not supported. The
Save Page ( SP ) field must be set to 0. Saved pages are not supported. The Parameter Pointer will be 0.
*/
var opcode uint8 = 0x4D
var ppc uint8 = 0
var sp uint8 = 0
var pc uint8 = 0b01
var parameterpointer uint16 = 0
var alloclen uint16 = 0
var controlbyte uint8 = 0
inqCmdBlk := []uint8{
opcode,
((ppc & 0b1) << 1) | (sp & 0b1),
((pc & 0b11) << 6) | (ls.PageCode & 0b111111),
ls.SubPageCode,
0,
uint8((parameterpointer & 0xFF00) >> 8),
uint8((parameterpointer & 0x00FF) >> 0),
uint8((alloclen & 0xFF00) >> 8),
uint8((alloclen & 0x00FF) >> 0),
controlbyte}
ioHdr := &sgio.SgIoHdr{
InterfaceID: int32('S'),
CmdLen: uint8(len(inqCmdBlk)),
MxSbLen: sgio.SENSE_BUF_LEN,
DxferDirection: sgio.SG_DXFER_FROM_DEV,
DxferLen: READ_ATT_REPLY_LEN,
Dxferp: &replyBuf[0],
Cmdp: &inqCmdBlk[0],
Sbp: &senseBuf[0],
Timeout: sgio.TIMEOUT_20_SECS,
}
err := sgio.SgioSyscall(drive.Dev, ioHdr)
if err != nil {
return err
}
err = sgio.CheckSense(ioHdr, &senseBuf)
if err != nil {
return err
}
fmt.Println(replyBuf)
return nil
}
func (drive *TapeDrive) String() string {
s := fmt.Sprintf("Drive information:\n")
s += fmt.Sprintf(" Vendor : %s\n", drive.InquiryInfo.Vendor)
s += fmt.Sprintf(" Model : %s\n", drive.InquiryInfo.Model)
s += fmt.Sprintf(" Firmware: %s\n", drive.InquiryInfo.Firmware)
s += drive.CmList.String()
return s
}
+38
View File
@@ -0,0 +1,38 @@
package main
import (
"context"
"os"
"github.com/abc950309/tapewriter/external"
"github.com/abc950309/tapewriter/library"
"github.com/abc950309/tapewriter/resource"
)
func main() {
ctx := context.Background()
db, err := resource.NewDBConn("sqlite", "./tapes.db")
if err != nil {
panic(err)
}
lib := library.New(db)
if err := lib.AutoMigrate(); err != nil {
panic(err)
}
file := os.Args[1]
barcode := os.Args[2]
name := os.Args[3]
f, err := os.Open(file)
if err != nil {
panic(err)
}
ext := external.New(lib)
if err := ext.ImportACPReport(ctx, barcode, name, "file:tape.key", f); err != nil {
panic(err)
}
}
+5 -2
View File
@@ -1,7 +1,6 @@
domain: http://127.0.0.1:8080
listen: 127.0.0.1:8080
debug_listen: 127.0.0.1:8081
work_directory: ./
database:
dialect: sqlite
@@ -10,10 +9,14 @@ database:
tape_devices:
- /dev/nst0
filesystem_root: ./
paths:
work: ./
source: ./
target: ./
scripts:
encrypt: ./scripts/encrypt
mkfs: ./scripts/mkfs
mount: ./scripts/mount
umount: ./scripts/umount
read_info: ./scripts/readinfo
+46 -22
View File
@@ -5,10 +5,10 @@ import (
"context"
"flag"
"fmt"
"io/ioutil"
"log"
"net/http"
"os"
"runtime/debug"
"time"
"github.com/abc950309/tapewriter/apis"
@@ -17,32 +17,30 @@ import (
"github.com/abc950309/tapewriter/library"
"github.com/abc950309/tapewriter/resource"
"github.com/abc950309/tapewriter/tools"
"github.com/grpc-ecosystem/go-grpc-middleware/v2/interceptors/recovery"
"github.com/improbable-eng/grpc-web/go/grpcweb"
rotatelogs "github.com/lestrrat-go/file-rotatelogs"
"github.com/rifflock/lfshook"
"github.com/sirupsen/logrus"
"google.golang.org/grpc"
"google.golang.org/grpc/codes"
"google.golang.org/grpc/status"
"gopkg.in/yaml.v2"
)
type config struct {
Domain string `yaml:"domain"`
Listen string `yaml:"listen"`
DebugListen string `yaml:"debug_listen"`
WorkDirectory string `yaml:"work_directory"`
Domain string `yaml:"domain"`
Listen string `yaml:"listen"`
DebugListen string `yaml:"debug_listen"`
Database struct {
Dialect string `yaml:"dialect"`
DSN string `yaml:"dsn"`
} `yaml:"database"`
TapeDevices []string `yaml:"tape_devices"`
FilesystemRoot string `yaml:"filesystem_root"`
Scripts struct {
Encrypt string `yaml:"encrypt"`
Mkfs string `yaml:"mkfs"`
Mount string `yaml:"mount"`
Umount string `yaml:"umount"`
} `yaml:"scripts"`
Paths executor.Paths `yaml:"paths"`
TapeDevices []string `yaml:"tape_devices"`
Scripts executor.Scripts `yaml:"scripts"`
}
var (
@@ -50,8 +48,24 @@ var (
)
func main() {
flag.Parse()
logWriter, err := rotatelogs.New(
"./run.log.%Y%m%d%H%M",
rotatelogs.WithLinkName("./run.log"),
rotatelogs.WithMaxAge(time.Duration(86400)*time.Second),
rotatelogs.WithRotationTime(time.Duration(604800)*time.Second),
)
if err != nil {
panic(err)
}
logrus.AddHook(lfshook.NewHook(
lfshook.WriterMap{
logrus.InfoLevel: logWriter,
logrus.ErrorLevel: logWriter,
},
&logrus.TextFormatter{},
))
flag.Parse()
cf, err := os.Open(*configPath)
if err != nil {
panic(err)
@@ -61,6 +75,7 @@ func main() {
if err := yaml.NewDecoder(cf).Decode(conf); err != nil {
panic(err)
}
logrus.Infof("read config success, conf= '%+v'", conf)
if conf.DebugListen != "" {
go tools.Wrap(context.Background(), func() { tools.NewDebugServer(conf.DebugListen) })
@@ -76,28 +91,37 @@ func main() {
panic(err)
}
exe := executor.New(
db, lib, conf.TapeDevices, conf.WorkDirectory,
conf.Scripts.Encrypt, conf.Scripts.Mkfs, conf.Scripts.Mount, conf.Scripts.Umount,
)
exe := executor.New(db, lib, conf.TapeDevices, conf.Paths, conf.Scripts)
if err := exe.AutoMigrate(); err != nil {
panic(err)
}
s := grpc.NewServer()
api := apis.New(conf.FilesystemRoot, lib, exe)
grpcPanicRecoveryHandler := func(p any) (err error) {
logrus.Infof("recovered from panic, %v, stack= %s", p, debug.Stack())
return status.Errorf(codes.Internal, "%s", p)
}
s := grpc.NewServer(
grpc.ChainUnaryInterceptor(
recovery.UnaryServerInterceptor(recovery.WithRecoveryHandler(grpcPanicRecoveryHandler)),
),
grpc.ChainStreamInterceptor(
recovery.StreamServerInterceptor(recovery.WithRecoveryHandler(grpcPanicRecoveryHandler)),
),
)
api := apis.New(conf.Paths.Source, lib, exe)
entity.RegisterServiceServer(s, api)
mux := http.NewServeMux()
grpcWebServer := grpcweb.WrapServer(s, grpcweb.WithOriginFunc(func(origin string) bool { return true }))
mux.Handle("/services/", http.StripPrefix("/services/", grpcWebServer))
mux.Handle("/files/", http.StripPrefix("/files", api.Uploader()))
fs := http.FileServer(http.Dir("./frontend/assets"))
mux.Handle("/assets/", http.StripPrefix("/assets/", fs))
mux.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) {
indexBuf, err := ioutil.ReadFile("./frontend/index.html")
indexBuf, err := os.ReadFile("./frontend/index.html")
if err != nil {
panic(err)
}
-89
View File
@@ -1,89 +0,0 @@
package main
import (
"context"
"flag"
"fmt"
"os"
"github.com/abc950309/tapewriter/executor"
"github.com/abc950309/tapewriter/library"
"github.com/abc950309/tapewriter/resource"
"gopkg.in/yaml.v2"
)
type config struct {
WorkDirectory string `yaml:"work_directory"`
Database struct {
Dialect string `yaml:"dialect"`
DSN string `yaml:"dsn"`
} `yaml:"database"`
TapeDevices []string `yaml:"tape_devices"`
FilesystemRoot string `yaml:"filesystem_root"`
Scripts struct {
Encrypt string `yaml:"encrypt"`
Mkfs string `yaml:"mkfs"`
Mount string `yaml:"mount"`
Umount string `yaml:"umount"`
} `yaml:"scripts"`
}
var (
configPath = flag.String("config", "./config.yaml", "config file path")
barcode = flag.String("barcode", "", "barcode for tape")
device = flag.String("device", "/dev/nst0", "barcode for tape")
)
func main() {
flag.Parse()
if *barcode == "" {
panic("expect barcode")
}
cf, err := os.Open(*configPath)
if err != nil {
panic(err)
}
conf := new(config)
if err := yaml.NewDecoder(cf).Decode(conf); err != nil {
panic(err)
}
db, err := resource.NewDBConn(conf.Database.Dialect, conf.Database.DSN)
if err != nil {
panic(err)
}
lib := library.New(db)
if err := lib.AutoMigrate(); err != nil {
panic(err)
}
exe := executor.New(
db, lib, conf.TapeDevices, conf.WorkDirectory,
conf.Scripts.Encrypt, conf.Scripts.Mkfs, conf.Scripts.Mount, conf.Scripts.Umount,
)
if err := exe.AutoMigrate(); err != nil {
panic(err)
}
ctx := context.Background()
tapes, err := lib.MGetTapeByBarcode(ctx, *barcode)
if err != nil {
panic(err)
}
tape := tapes[*barcode]
if tape == nil {
panic(fmt.Errorf("tape not found, barcode= %s", *barcode))
}
if err := exe.RestoreLoadTape(ctx, *device, tape); err != nil {
panic(err)
}
}
+23 -23
View File
@@ -23,31 +23,31 @@ const (
type CopyStatus int32
const (
CopyStatus_Draft CopyStatus = 0
CopyStatus_Pending CopyStatus = 1 // waiting in queue
CopyStatus_Running CopyStatus = 2
CopyStatus_Staged CopyStatus = 3
CopyStatus_Submited CopyStatus = 4
CopyStatus_Failed CopyStatus = 255
CopyStatus_DRAFT CopyStatus = 0
CopyStatus_PENDING CopyStatus = 1 // waiting in queue
CopyStatus_RUNNING CopyStatus = 2
CopyStatus_STAGED CopyStatus = 3
CopyStatus_SUBMITED CopyStatus = 4
CopyStatus_FAILED CopyStatus = 255
)
// Enum value maps for CopyStatus.
var (
CopyStatus_name = map[int32]string{
0: "Draft",
1: "Pending",
2: "Running",
3: "Staged",
4: "Submited",
255: "Failed",
0: "DRAFT",
1: "PENDING",
2: "RUNNING",
3: "STAGED",
4: "SUBMITED",
255: "FAILED",
}
CopyStatus_value = map[string]int32{
"Draft": 0,
"Pending": 1,
"Running": 2,
"Staged": 3,
"Submited": 4,
"Failed": 255,
"DRAFT": 0,
"PENDING": 1,
"RUNNING": 2,
"STAGED": 3,
"SUBMITED": 4,
"FAILED": 255,
}
)
@@ -84,11 +84,11 @@ var file_copy_status_proto_rawDesc = []byte{
0x0a, 0x11, 0x63, 0x6f, 0x70, 0x79, 0x5f, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x2e, 0x70, 0x72,
0x6f, 0x74, 0x6f, 0x12, 0x0b, 0x63, 0x6f, 0x70, 0x79, 0x5f, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73,
0x2a, 0x58, 0x0a, 0x0a, 0x43, 0x6f, 0x70, 0x79, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x09,
0x0a, 0x05, 0x44, 0x72, 0x61, 0x66, 0x74, 0x10, 0x00, 0x12, 0x0b, 0x0a, 0x07, 0x50, 0x65, 0x6e,
0x64, 0x69, 0x6e, 0x67, 0x10, 0x01, 0x12, 0x0b, 0x0a, 0x07, 0x52, 0x75, 0x6e, 0x6e, 0x69, 0x6e,
0x67, 0x10, 0x02, 0x12, 0x0a, 0x0a, 0x06, 0x53, 0x74, 0x61, 0x67, 0x65, 0x64, 0x10, 0x03, 0x12,
0x0c, 0x0a, 0x08, 0x53, 0x75, 0x62, 0x6d, 0x69, 0x74, 0x65, 0x64, 0x10, 0x04, 0x12, 0x0b, 0x0a,
0x06, 0x46, 0x61, 0x69, 0x6c, 0x65, 0x64, 0x10, 0xff, 0x01, 0x42, 0x28, 0x5a, 0x26, 0x67, 0x69,
0x0a, 0x05, 0x44, 0x52, 0x41, 0x46, 0x54, 0x10, 0x00, 0x12, 0x0b, 0x0a, 0x07, 0x50, 0x45, 0x4e,
0x44, 0x49, 0x4e, 0x47, 0x10, 0x01, 0x12, 0x0b, 0x0a, 0x07, 0x52, 0x55, 0x4e, 0x4e, 0x49, 0x4e,
0x47, 0x10, 0x02, 0x12, 0x0a, 0x0a, 0x06, 0x53, 0x54, 0x41, 0x47, 0x45, 0x44, 0x10, 0x03, 0x12,
0x0c, 0x0a, 0x08, 0x53, 0x55, 0x42, 0x4d, 0x49, 0x54, 0x45, 0x44, 0x10, 0x04, 0x12, 0x0b, 0x0a,
0x06, 0x46, 0x41, 0x49, 0x4c, 0x45, 0x44, 0x10, 0xff, 0x01, 0x42, 0x28, 0x5a, 0x26, 0x67, 0x69,
0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x61, 0x62, 0x63, 0x39, 0x35, 0x30, 0x33,
0x30, 0x39, 0x2f, 0x74, 0x61, 0x70, 0x65, 0x77, 0x72, 0x69, 0x74, 0x65, 0x72, 0x2f, 0x65, 0x6e,
0x74, 0x69, 0x74, 0x79, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
+6 -6
View File
@@ -4,11 +4,11 @@ package copy_status;
option go_package = "github.com/abc950309/tapewriter/entity";
enum CopyStatus {
Draft = 0;
Pending = 1; // waiting in queue
Running = 2;
Staged = 3;
Submited = 4;
DRAFT = 0;
PENDING = 1; // waiting in queue
RUNNING = 2;
STAGED = 3;
SUBMITED = 4;
Failed = 255;
FAILED = 255;
}
+4
View File
@@ -25,8 +25,12 @@ var (
func (x *JobState) Scan(src any) error {
return Scan(x, src)
// Scan(x, src)
// return nil
}
func (x *JobState) Value() (driver.Value, error) {
return Value(x)
// val, _ := Value(x)
// return val, nil
}
+182 -97
View File
@@ -23,31 +23,31 @@ const (
type JobStatus int32
const (
JobStatus_Draft JobStatus = 0
JobStatus_NotReady JobStatus = 1 // dependencies not satisfied
JobStatus_Pending JobStatus = 2 // waiting in queue
JobStatus_Processing JobStatus = 3
JobStatus_Completed JobStatus = 4
JobStatus_Failed JobStatus = 255
JobStatus_DRAFT JobStatus = 0
JobStatus_NOT_READY JobStatus = 1 // dependencies not satisfied
JobStatus_PENDING JobStatus = 2 // waiting in queue
JobStatus_PROCESSING JobStatus = 3
JobStatus_COMPLETED JobStatus = 4
JobStatus_FAILED JobStatus = 255
)
// Enum value maps for JobStatus.
var (
JobStatus_name = map[int32]string{
0: "Draft",
1: "NotReady",
2: "Pending",
3: "Processing",
4: "Completed",
255: "Failed",
0: "DRAFT",
1: "NOT_READY",
2: "PENDING",
3: "PROCESSING",
4: "COMPLETED",
255: "FAILED",
}
JobStatus_value = map[string]int32{
"Draft": 0,
"NotReady": 1,
"Pending": 2,
"Processing": 3,
"Completed": 4,
"Failed": 255,
"DRAFT": 0,
"NOT_READY": 1,
"PENDING": 2,
"PROCESSING": 3,
"COMPLETED": 4,
"FAILED": 255,
}
)
@@ -134,7 +134,7 @@ func (x *Job) GetStatus() JobStatus {
if x != nil {
return x.Status
}
return JobStatus_Draft
return JobStatus_DRAFT
}
func (x *Job) GetPriority() int64 {
@@ -172,6 +172,7 @@ type JobParam struct {
// Types that are assignable to Param:
// *JobParam_Archive
// *JobParam_Restore
Param isJobParam_Param `protobuf_oneof:"param"`
}
@@ -214,23 +215,36 @@ func (m *JobParam) GetParam() isJobParam_Param {
return nil
}
func (x *JobParam) GetArchive() *JobParamArchive {
func (x *JobParam) GetArchive() *JobArchiveParam {
if x, ok := x.GetParam().(*JobParam_Archive); ok {
return x.Archive
}
return nil
}
func (x *JobParam) GetRestore() *JobRestoreParam {
if x, ok := x.GetParam().(*JobParam_Restore); ok {
return x.Restore
}
return nil
}
type isJobParam_Param interface {
isJobParam_Param()
}
type JobParam_Archive struct {
Archive *JobParamArchive `protobuf:"bytes,1,opt,name=Archive,proto3,oneof"`
Archive *JobArchiveParam `protobuf:"bytes,1,opt,name=archive,proto3,oneof"`
}
type JobParam_Restore struct {
Restore *JobRestoreParam `protobuf:"bytes,2,opt,name=restore,proto3,oneof"`
}
func (*JobParam_Archive) isJobParam_Param() {}
func (*JobParam_Restore) isJobParam_Param() {}
type JobState struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
@@ -238,6 +252,7 @@ type JobState struct {
// Types that are assignable to State:
// *JobState_Archive
// *JobState_Restore
State isJobState_State `protobuf_oneof:"state"`
}
@@ -280,23 +295,36 @@ func (m *JobState) GetState() isJobState_State {
return nil
}
func (x *JobState) GetArchive() *JobStateArchive {
func (x *JobState) GetArchive() *JobArchiveState {
if x, ok := x.GetState().(*JobState_Archive); ok {
return x.Archive
}
return nil
}
func (x *JobState) GetRestore() *JobRestoreState {
if x, ok := x.GetState().(*JobState_Restore); ok {
return x.Restore
}
return nil
}
type isJobState_State interface {
isJobState_State()
}
type JobState_Archive struct {
Archive *JobStateArchive `protobuf:"bytes,1,opt,name=Archive,proto3,oneof"`
Archive *JobArchiveState `protobuf:"bytes,1,opt,name=archive,proto3,oneof"`
}
type JobState_Restore struct {
Restore *JobRestoreState `protobuf:"bytes,2,opt,name=restore,proto3,oneof"`
}
func (*JobState_Archive) isJobState_State() {}
func (*JobState_Restore) isJobState_State() {}
type JobNextParam struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
@@ -304,6 +332,7 @@ type JobNextParam struct {
// Types that are assignable to Param:
// *JobNextParam_Archive
// *JobNextParam_Restore
Param isJobNextParam_Param `protobuf_oneof:"param"`
}
@@ -353,6 +382,13 @@ func (x *JobNextParam) GetArchive() *JobArchiveNextParam {
return nil
}
func (x *JobNextParam) GetRestore() *JobRestoreNextParam {
if x, ok := x.GetParam().(*JobNextParam_Restore); ok {
return x.Restore
}
return nil
}
type isJobNextParam_Param interface {
isJobNextParam_Param()
}
@@ -361,8 +397,14 @@ type JobNextParam_Archive struct {
Archive *JobArchiveNextParam `protobuf:"bytes,1,opt,name=archive,proto3,oneof"`
}
type JobNextParam_Restore struct {
Restore *JobRestoreNextParam `protobuf:"bytes,2,opt,name=restore,proto3,oneof"`
}
func (*JobNextParam_Archive) isJobNextParam_Param() {}
func (*JobNextParam_Restore) isJobNextParam_Param() {}
type CreatableJob struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
@@ -464,7 +506,7 @@ func (x *JobFilter) GetStatus() JobStatus {
if x != nil && x.Status != nil {
return *x.Status
}
return JobStatus_Draft
return JobStatus_DRAFT
}
func (x *JobFilter) GetLimit() int64 {
@@ -488,6 +530,7 @@ type JobDisplay struct {
// Types that are assignable to Display:
// *JobDisplay_Archive
// *JobDisplay_Restore
Display isJobDisplay_Display `protobuf_oneof:"display"`
}
@@ -530,85 +573,114 @@ func (m *JobDisplay) GetDisplay() isJobDisplay_Display {
return nil
}
func (x *JobDisplay) GetArchive() *JobDisplayArchive {
func (x *JobDisplay) GetArchive() *JobArchiveDisplay {
if x, ok := x.GetDisplay().(*JobDisplay_Archive); ok {
return x.Archive
}
return nil
}
func (x *JobDisplay) GetRestore() *JobRestoreDisplay {
if x, ok := x.GetDisplay().(*JobDisplay_Restore); ok {
return x.Restore
}
return nil
}
type isJobDisplay_Display interface {
isJobDisplay_Display()
}
type JobDisplay_Archive struct {
Archive *JobDisplayArchive `protobuf:"bytes,1,opt,name=archive,proto3,oneof"`
Archive *JobArchiveDisplay `protobuf:"bytes,1,opt,name=archive,proto3,oneof"`
}
type JobDisplay_Restore struct {
Restore *JobRestoreDisplay `protobuf:"bytes,2,opt,name=restore,proto3,oneof"`
}
func (*JobDisplay_Archive) isJobDisplay_Display() {}
func (*JobDisplay_Restore) isJobDisplay_Display() {}
var File_job_proto protoreflect.FileDescriptor
var file_job_proto_rawDesc = []byte{
0x0a, 0x09, 0x6a, 0x6f, 0x62, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x03, 0x6a, 0x6f, 0x62,
0x1a, 0x11, 0x6a, 0x6f, 0x62, 0x5f, 0x61, 0x72, 0x63, 0x68, 0x69, 0x76, 0x65, 0x2e, 0x70, 0x72,
0x6f, 0x74, 0x6f, 0x22, 0xc0, 0x01, 0x0a, 0x03, 0x4a, 0x6f, 0x62, 0x12, 0x0e, 0x0a, 0x02, 0x69,
0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x02, 0x69, 0x64, 0x12, 0x26, 0x0a, 0x06, 0x73,
0x74, 0x61, 0x74, 0x75, 0x73, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x0e, 0x2e, 0x6a, 0x6f,
0x62, 0x2e, 0x4a, 0x6f, 0x62, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x52, 0x06, 0x73, 0x74, 0x61,
0x74, 0x75, 0x73, 0x12, 0x1a, 0x0a, 0x08, 0x70, 0x72, 0x69, 0x6f, 0x72, 0x69, 0x74, 0x79, 0x18,
0x6f, 0x74, 0x6f, 0x1a, 0x11, 0x6a, 0x6f, 0x62, 0x5f, 0x72, 0x65, 0x73, 0x74, 0x6f, 0x72, 0x65,
0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0xc0, 0x01, 0x0a, 0x03, 0x4a, 0x6f, 0x62, 0x12, 0x0e,
0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x02, 0x69, 0x64, 0x12, 0x26,
0x0a, 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x0e,
0x2e, 0x6a, 0x6f, 0x62, 0x2e, 0x4a, 0x6f, 0x62, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x52, 0x06,
0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x1a, 0x0a, 0x08, 0x70, 0x72, 0x69, 0x6f, 0x72, 0x69,
0x74, 0x79, 0x18, 0x03, 0x20, 0x01, 0x28, 0x03, 0x52, 0x08, 0x70, 0x72, 0x69, 0x6f, 0x72, 0x69,
0x74, 0x79, 0x12, 0x1f, 0x0a, 0x0b, 0x63, 0x72, 0x65, 0x61, 0x74, 0x65, 0x5f, 0x74, 0x69, 0x6d,
0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x03, 0x52, 0x0a, 0x63, 0x72, 0x65, 0x61, 0x74, 0x65, 0x54,
0x69, 0x6d, 0x65, 0x12, 0x1f, 0x0a, 0x0b, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x5f, 0x74, 0x69,
0x6d, 0x65, 0x18, 0x05, 0x20, 0x01, 0x28, 0x03, 0x52, 0x0a, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65,
0x54, 0x69, 0x6d, 0x65, 0x12, 0x23, 0x0a, 0x05, 0x73, 0x74, 0x61, 0x74, 0x65, 0x18, 0x11, 0x20,
0x01, 0x28, 0x0b, 0x32, 0x0d, 0x2e, 0x6a, 0x6f, 0x62, 0x2e, 0x4a, 0x6f, 0x62, 0x53, 0x74, 0x61,
0x74, 0x65, 0x52, 0x05, 0x73, 0x74, 0x61, 0x74, 0x65, 0x22, 0x87, 0x01, 0x0a, 0x08, 0x4a, 0x6f,
0x62, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x12, 0x38, 0x0a, 0x07, 0x61, 0x72, 0x63, 0x68, 0x69, 0x76,
0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1c, 0x2e, 0x6a, 0x6f, 0x62, 0x5f, 0x61, 0x72,
0x63, 0x68, 0x69, 0x76, 0x65, 0x2e, 0x4a, 0x6f, 0x62, 0x41, 0x72, 0x63, 0x68, 0x69, 0x76, 0x65,
0x50, 0x61, 0x72, 0x61, 0x6d, 0x48, 0x00, 0x52, 0x07, 0x61, 0x72, 0x63, 0x68, 0x69, 0x76, 0x65,
0x12, 0x38, 0x0a, 0x07, 0x72, 0x65, 0x73, 0x74, 0x6f, 0x72, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28,
0x0b, 0x32, 0x1c, 0x2e, 0x6a, 0x6f, 0x62, 0x5f, 0x72, 0x65, 0x73, 0x74, 0x6f, 0x72, 0x65, 0x2e,
0x4a, 0x6f, 0x62, 0x52, 0x65, 0x73, 0x74, 0x6f, 0x72, 0x65, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x48,
0x00, 0x52, 0x07, 0x72, 0x65, 0x73, 0x74, 0x6f, 0x72, 0x65, 0x42, 0x07, 0x0a, 0x05, 0x70, 0x61,
0x72, 0x61, 0x6d, 0x22, 0x87, 0x01, 0x0a, 0x08, 0x4a, 0x6f, 0x62, 0x53, 0x74, 0x61, 0x74, 0x65,
0x12, 0x38, 0x0a, 0x07, 0x61, 0x72, 0x63, 0x68, 0x69, 0x76, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28,
0x0b, 0x32, 0x1c, 0x2e, 0x6a, 0x6f, 0x62, 0x5f, 0x61, 0x72, 0x63, 0x68, 0x69, 0x76, 0x65, 0x2e,
0x4a, 0x6f, 0x62, 0x41, 0x72, 0x63, 0x68, 0x69, 0x76, 0x65, 0x53, 0x74, 0x61, 0x74, 0x65, 0x48,
0x00, 0x52, 0x07, 0x61, 0x72, 0x63, 0x68, 0x69, 0x76, 0x65, 0x12, 0x38, 0x0a, 0x07, 0x72, 0x65,
0x73, 0x74, 0x6f, 0x72, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1c, 0x2e, 0x6a, 0x6f,
0x62, 0x5f, 0x72, 0x65, 0x73, 0x74, 0x6f, 0x72, 0x65, 0x2e, 0x4a, 0x6f, 0x62, 0x52, 0x65, 0x73,
0x74, 0x6f, 0x72, 0x65, 0x53, 0x74, 0x61, 0x74, 0x65, 0x48, 0x00, 0x52, 0x07, 0x72, 0x65, 0x73,
0x74, 0x6f, 0x72, 0x65, 0x42, 0x07, 0x0a, 0x05, 0x73, 0x74, 0x61, 0x74, 0x65, 0x22, 0x93, 0x01,
0x0a, 0x0c, 0x4a, 0x6f, 0x62, 0x4e, 0x65, 0x78, 0x74, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x12, 0x3c,
0x0a, 0x07, 0x61, 0x72, 0x63, 0x68, 0x69, 0x76, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32,
0x20, 0x2e, 0x6a, 0x6f, 0x62, 0x5f, 0x61, 0x72, 0x63, 0x68, 0x69, 0x76, 0x65, 0x2e, 0x4a, 0x6f,
0x62, 0x41, 0x72, 0x63, 0x68, 0x69, 0x76, 0x65, 0x4e, 0x65, 0x78, 0x74, 0x50, 0x61, 0x72, 0x61,
0x6d, 0x48, 0x00, 0x52, 0x07, 0x61, 0x72, 0x63, 0x68, 0x69, 0x76, 0x65, 0x12, 0x3c, 0x0a, 0x07,
0x72, 0x65, 0x73, 0x74, 0x6f, 0x72, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x20, 0x2e,
0x6a, 0x6f, 0x62, 0x5f, 0x72, 0x65, 0x73, 0x74, 0x6f, 0x72, 0x65, 0x2e, 0x4a, 0x6f, 0x62, 0x52,
0x65, 0x73, 0x74, 0x6f, 0x72, 0x65, 0x4e, 0x65, 0x78, 0x74, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x48,
0x00, 0x52, 0x07, 0x72, 0x65, 0x73, 0x74, 0x6f, 0x72, 0x65, 0x42, 0x07, 0x0a, 0x05, 0x70, 0x61,
0x72, 0x61, 0x6d, 0x22, 0x4f, 0x0a, 0x0c, 0x43, 0x72, 0x65, 0x61, 0x74, 0x61, 0x62, 0x6c, 0x65,
0x4a, 0x6f, 0x62, 0x12, 0x1a, 0x0a, 0x08, 0x70, 0x72, 0x69, 0x6f, 0x72, 0x69, 0x74, 0x79, 0x18,
0x03, 0x20, 0x01, 0x28, 0x03, 0x52, 0x08, 0x70, 0x72, 0x69, 0x6f, 0x72, 0x69, 0x74, 0x79, 0x12,
0x1f, 0x0a, 0x0b, 0x63, 0x72, 0x65, 0x61, 0x74, 0x65, 0x5f, 0x74, 0x69, 0x6d, 0x65, 0x18, 0x04,
0x20, 0x01, 0x28, 0x03, 0x52, 0x0a, 0x63, 0x72, 0x65, 0x61, 0x74, 0x65, 0x54, 0x69, 0x6d, 0x65,
0x12, 0x1f, 0x0a, 0x0b, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x5f, 0x74, 0x69, 0x6d, 0x65, 0x18,
0x05, 0x20, 0x01, 0x28, 0x03, 0x52, 0x0a, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x54, 0x69, 0x6d,
0x65, 0x12, 0x23, 0x0a, 0x05, 0x73, 0x74, 0x61, 0x74, 0x65, 0x18, 0x11, 0x20, 0x01, 0x28, 0x0b,
0x32, 0x0d, 0x2e, 0x6a, 0x6f, 0x62, 0x2e, 0x4a, 0x6f, 0x62, 0x53, 0x74, 0x61, 0x74, 0x65, 0x52,
0x05, 0x73, 0x74, 0x61, 0x74, 0x65, 0x22, 0x4d, 0x0a, 0x08, 0x4a, 0x6f, 0x62, 0x50, 0x61, 0x72,
0x61, 0x6d, 0x12, 0x38, 0x0a, 0x07, 0x41, 0x72, 0x63, 0x68, 0x69, 0x76, 0x65, 0x18, 0x01, 0x20,
0x01, 0x28, 0x0b, 0x32, 0x1c, 0x2e, 0x6a, 0x6f, 0x62, 0x5f, 0x61, 0x72, 0x63, 0x68, 0x69, 0x76,
0x65, 0x2e, 0x4a, 0x6f, 0x62, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x41, 0x72, 0x63, 0x68, 0x69, 0x76,
0x65, 0x48, 0x00, 0x52, 0x07, 0x41, 0x72, 0x63, 0x68, 0x69, 0x76, 0x65, 0x42, 0x07, 0x0a, 0x05,
0x70, 0x61, 0x72, 0x61, 0x6d, 0x22, 0x4d, 0x0a, 0x08, 0x4a, 0x6f, 0x62, 0x53, 0x74, 0x61, 0x74,
0x65, 0x12, 0x38, 0x0a, 0x07, 0x41, 0x72, 0x63, 0x68, 0x69, 0x76, 0x65, 0x18, 0x01, 0x20, 0x01,
0x28, 0x0b, 0x32, 0x1c, 0x2e, 0x6a, 0x6f, 0x62, 0x5f, 0x61, 0x72, 0x63, 0x68, 0x69, 0x76, 0x65,
0x2e, 0x4a, 0x6f, 0x62, 0x53, 0x74, 0x61, 0x74, 0x65, 0x41, 0x72, 0x63, 0x68, 0x69, 0x76, 0x65,
0x48, 0x00, 0x52, 0x07, 0x41, 0x72, 0x63, 0x68, 0x69, 0x76, 0x65, 0x42, 0x07, 0x0a, 0x05, 0x73,
0x74, 0x61, 0x74, 0x65, 0x22, 0x55, 0x0a, 0x0c, 0x4a, 0x6f, 0x62, 0x4e, 0x65, 0x78, 0x74, 0x50,
0x61, 0x72, 0x61, 0x6d, 0x12, 0x3c, 0x0a, 0x07, 0x61, 0x72, 0x63, 0x68, 0x69, 0x76, 0x65, 0x18,
0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x20, 0x2e, 0x6a, 0x6f, 0x62, 0x5f, 0x61, 0x72, 0x63, 0x68,
0x69, 0x76, 0x65, 0x2e, 0x4a, 0x6f, 0x62, 0x41, 0x72, 0x63, 0x68, 0x69, 0x76, 0x65, 0x4e, 0x65,
0x78, 0x74, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x48, 0x00, 0x52, 0x07, 0x61, 0x72, 0x63, 0x68, 0x69,
0x76, 0x65, 0x42, 0x07, 0x0a, 0x05, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x22, 0x4f, 0x0a, 0x0c, 0x43,
0x72, 0x65, 0x61, 0x74, 0x61, 0x62, 0x6c, 0x65, 0x4a, 0x6f, 0x62, 0x12, 0x1a, 0x0a, 0x08, 0x70,
0x72, 0x69, 0x6f, 0x72, 0x69, 0x74, 0x79, 0x18, 0x03, 0x20, 0x01, 0x28, 0x03, 0x52, 0x08, 0x70,
0x72, 0x69, 0x6f, 0x72, 0x69, 0x74, 0x79, 0x12, 0x23, 0x0a, 0x05, 0x70, 0x61, 0x72, 0x61, 0x6d,
0x18, 0x11, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0d, 0x2e, 0x6a, 0x6f, 0x62, 0x2e, 0x4a, 0x6f, 0x62,
0x50, 0x61, 0x72, 0x61, 0x6d, 0x52, 0x05, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x22, 0x90, 0x01, 0x0a,
0x09, 0x4a, 0x6f, 0x62, 0x46, 0x69, 0x6c, 0x74, 0x65, 0x72, 0x12, 0x2b, 0x0a, 0x06, 0x73, 0x74,
0x61, 0x74, 0x75, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x0e, 0x2e, 0x6a, 0x6f, 0x62,
0x2e, 0x4a, 0x6f, 0x62, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x48, 0x00, 0x52, 0x06, 0x73, 0x74,
0x61, 0x74, 0x75, 0x73, 0x88, 0x01, 0x01, 0x12, 0x19, 0x0a, 0x05, 0x6c, 0x69, 0x6d, 0x69, 0x74,
0x18, 0x21, 0x20, 0x01, 0x28, 0x03, 0x48, 0x01, 0x52, 0x05, 0x6c, 0x69, 0x6d, 0x69, 0x74, 0x88,
0x01, 0x01, 0x12, 0x1b, 0x0a, 0x06, 0x6f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x18, 0x22, 0x20, 0x01,
0x28, 0x03, 0x48, 0x02, 0x52, 0x06, 0x6f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x88, 0x01, 0x01, 0x42,
0x09, 0x0a, 0x07, 0x5f, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x6c,
0x69, 0x6d, 0x69, 0x74, 0x42, 0x09, 0x0a, 0x07, 0x5f, 0x6f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x22,
0x53, 0x0a, 0x0a, 0x4a, 0x6f, 0x62, 0x44, 0x69, 0x73, 0x70, 0x6c, 0x61, 0x79, 0x12, 0x3a, 0x0a,
0x07, 0x61, 0x72, 0x63, 0x68, 0x69, 0x76, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1e,
0x2e, 0x6a, 0x6f, 0x62, 0x5f, 0x61, 0x72, 0x63, 0x68, 0x69, 0x76, 0x65, 0x2e, 0x4a, 0x6f, 0x62,
0x44, 0x69, 0x73, 0x70, 0x6c, 0x61, 0x79, 0x41, 0x72, 0x63, 0x68, 0x69, 0x76, 0x65, 0x48, 0x00,
0x52, 0x07, 0x61, 0x72, 0x63, 0x68, 0x69, 0x76, 0x65, 0x42, 0x09, 0x0a, 0x07, 0x64, 0x69, 0x73,
0x70, 0x6c, 0x61, 0x79, 0x2a, 0x5d, 0x0a, 0x09, 0x4a, 0x6f, 0x62, 0x53, 0x74, 0x61, 0x74, 0x75,
0x73, 0x12, 0x09, 0x0a, 0x05, 0x44, 0x72, 0x61, 0x66, 0x74, 0x10, 0x00, 0x12, 0x0c, 0x0a, 0x08,
0x4e, 0x6f, 0x74, 0x52, 0x65, 0x61, 0x64, 0x79, 0x10, 0x01, 0x12, 0x0b, 0x0a, 0x07, 0x50, 0x65,
0x6e, 0x64, 0x69, 0x6e, 0x67, 0x10, 0x02, 0x12, 0x0e, 0x0a, 0x0a, 0x50, 0x72, 0x6f, 0x63, 0x65,
0x73, 0x73, 0x69, 0x6e, 0x67, 0x10, 0x03, 0x12, 0x0d, 0x0a, 0x09, 0x43, 0x6f, 0x6d, 0x70, 0x6c,
0x65, 0x74, 0x65, 0x64, 0x10, 0x04, 0x12, 0x0b, 0x0a, 0x06, 0x46, 0x61, 0x69, 0x6c, 0x65, 0x64,
0x10, 0xff, 0x01, 0x42, 0x28, 0x5a, 0x26, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f,
0x6d, 0x2f, 0x61, 0x62, 0x63, 0x39, 0x35, 0x30, 0x33, 0x30, 0x39, 0x2f, 0x74, 0x61, 0x70, 0x65,
0x77, 0x72, 0x69, 0x74, 0x65, 0x72, 0x2f, 0x65, 0x6e, 0x74, 0x69, 0x74, 0x79, 0x62, 0x06, 0x70,
0x72, 0x6f, 0x74, 0x6f, 0x33,
0x23, 0x0a, 0x05, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x18, 0x11, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0d,
0x2e, 0x6a, 0x6f, 0x62, 0x2e, 0x4a, 0x6f, 0x62, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x52, 0x05, 0x70,
0x61, 0x72, 0x61, 0x6d, 0x22, 0x90, 0x01, 0x0a, 0x09, 0x4a, 0x6f, 0x62, 0x46, 0x69, 0x6c, 0x74,
0x65, 0x72, 0x12, 0x2b, 0x0a, 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x18, 0x01, 0x20, 0x01,
0x28, 0x0e, 0x32, 0x0e, 0x2e, 0x6a, 0x6f, 0x62, 0x2e, 0x4a, 0x6f, 0x62, 0x53, 0x74, 0x61, 0x74,
0x75, 0x73, 0x48, 0x00, 0x52, 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x88, 0x01, 0x01, 0x12,
0x19, 0x0a, 0x05, 0x6c, 0x69, 0x6d, 0x69, 0x74, 0x18, 0x21, 0x20, 0x01, 0x28, 0x03, 0x48, 0x01,
0x52, 0x05, 0x6c, 0x69, 0x6d, 0x69, 0x74, 0x88, 0x01, 0x01, 0x12, 0x1b, 0x0a, 0x06, 0x6f, 0x66,
0x66, 0x73, 0x65, 0x74, 0x18, 0x22, 0x20, 0x01, 0x28, 0x03, 0x48, 0x02, 0x52, 0x06, 0x6f, 0x66,
0x66, 0x73, 0x65, 0x74, 0x88, 0x01, 0x01, 0x42, 0x09, 0x0a, 0x07, 0x5f, 0x73, 0x74, 0x61, 0x74,
0x75, 0x73, 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x6c, 0x69, 0x6d, 0x69, 0x74, 0x42, 0x09, 0x0a, 0x07,
0x5f, 0x6f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x22, 0x8f, 0x01, 0x0a, 0x0a, 0x4a, 0x6f, 0x62, 0x44,
0x69, 0x73, 0x70, 0x6c, 0x61, 0x79, 0x12, 0x3a, 0x0a, 0x07, 0x61, 0x72, 0x63, 0x68, 0x69, 0x76,
0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1e, 0x2e, 0x6a, 0x6f, 0x62, 0x5f, 0x61, 0x72,
0x63, 0x68, 0x69, 0x76, 0x65, 0x2e, 0x4a, 0x6f, 0x62, 0x41, 0x72, 0x63, 0x68, 0x69, 0x76, 0x65,
0x44, 0x69, 0x73, 0x70, 0x6c, 0x61, 0x79, 0x48, 0x00, 0x52, 0x07, 0x61, 0x72, 0x63, 0x68, 0x69,
0x76, 0x65, 0x12, 0x3a, 0x0a, 0x07, 0x72, 0x65, 0x73, 0x74, 0x6f, 0x72, 0x65, 0x18, 0x02, 0x20,
0x01, 0x28, 0x0b, 0x32, 0x1e, 0x2e, 0x6a, 0x6f, 0x62, 0x5f, 0x72, 0x65, 0x73, 0x74, 0x6f, 0x72,
0x65, 0x2e, 0x4a, 0x6f, 0x62, 0x52, 0x65, 0x73, 0x74, 0x6f, 0x72, 0x65, 0x44, 0x69, 0x73, 0x70,
0x6c, 0x61, 0x79, 0x48, 0x00, 0x52, 0x07, 0x72, 0x65, 0x73, 0x74, 0x6f, 0x72, 0x65, 0x42, 0x09,
0x0a, 0x07, 0x64, 0x69, 0x73, 0x70, 0x6c, 0x61, 0x79, 0x2a, 0x5e, 0x0a, 0x09, 0x4a, 0x6f, 0x62,
0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x09, 0x0a, 0x05, 0x44, 0x52, 0x41, 0x46, 0x54, 0x10,
0x00, 0x12, 0x0d, 0x0a, 0x09, 0x4e, 0x4f, 0x54, 0x5f, 0x52, 0x45, 0x41, 0x44, 0x59, 0x10, 0x01,
0x12, 0x0b, 0x0a, 0x07, 0x50, 0x45, 0x4e, 0x44, 0x49, 0x4e, 0x47, 0x10, 0x02, 0x12, 0x0e, 0x0a,
0x0a, 0x50, 0x52, 0x4f, 0x43, 0x45, 0x53, 0x53, 0x49, 0x4e, 0x47, 0x10, 0x03, 0x12, 0x0d, 0x0a,
0x09, 0x43, 0x4f, 0x4d, 0x50, 0x4c, 0x45, 0x54, 0x45, 0x44, 0x10, 0x04, 0x12, 0x0b, 0x0a, 0x06,
0x46, 0x41, 0x49, 0x4c, 0x45, 0x44, 0x10, 0xff, 0x01, 0x42, 0x28, 0x5a, 0x26, 0x67, 0x69, 0x74,
0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x61, 0x62, 0x63, 0x39, 0x35, 0x30, 0x33, 0x30,
0x39, 0x2f, 0x74, 0x61, 0x70, 0x65, 0x77, 0x72, 0x69, 0x74, 0x65, 0x72, 0x2f, 0x65, 0x6e, 0x74,
0x69, 0x74, 0x79, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
}
var (
@@ -634,25 +706,33 @@ var file_job_proto_goTypes = []interface{}{
(*CreatableJob)(nil), // 5: job.CreatableJob
(*JobFilter)(nil), // 6: job.JobFilter
(*JobDisplay)(nil), // 7: job.JobDisplay
(*JobParamArchive)(nil), // 8: job_archive.JobParamArchive
(*JobStateArchive)(nil), // 9: job_archive.JobStateArchive
(*JobArchiveNextParam)(nil), // 10: job_archive.JobArchiveNextParam
(*JobDisplayArchive)(nil), // 11: job_archive.JobDisplayArchive
(*JobArchiveParam)(nil), // 8: job_archive.JobArchiveParam
(*JobRestoreParam)(nil), // 9: job_restore.JobRestoreParam
(*JobArchiveState)(nil), // 10: job_archive.JobArchiveState
(*JobRestoreState)(nil), // 11: job_restore.JobRestoreState
(*JobArchiveNextParam)(nil), // 12: job_archive.JobArchiveNextParam
(*JobRestoreNextParam)(nil), // 13: job_restore.JobRestoreNextParam
(*JobArchiveDisplay)(nil), // 14: job_archive.JobArchiveDisplay
(*JobRestoreDisplay)(nil), // 15: job_restore.JobRestoreDisplay
}
var file_job_proto_depIdxs = []int32{
0, // 0: job.Job.status:type_name -> job.JobStatus
3, // 1: job.Job.state:type_name -> job.JobState
8, // 2: job.JobParam.Archive:type_name -> job_archive.JobParamArchive
9, // 3: job.JobState.Archive:type_name -> job_archive.JobStateArchive
10, // 4: job.JobNextParam.archive:type_name -> job_archive.JobArchiveNextParam
2, // 5: job.CreatableJob.param:type_name -> job.JobParam
0, // 6: job.JobFilter.status:type_name -> job.JobStatus
11, // 7: job.JobDisplay.archive:type_name -> job_archive.JobDisplayArchive
8, // [8:8] is the sub-list for method output_type
8, // [8:8] is the sub-list for method input_type
8, // [8:8] is the sub-list for extension type_name
8, // [8:8] is the sub-list for extension extendee
0, // [0:8] is the sub-list for field type_name
8, // 2: job.JobParam.archive:type_name -> job_archive.JobArchiveParam
9, // 3: job.JobParam.restore:type_name -> job_restore.JobRestoreParam
10, // 4: job.JobState.archive:type_name -> job_archive.JobArchiveState
11, // 5: job.JobState.restore:type_name -> job_restore.JobRestoreState
12, // 6: job.JobNextParam.archive:type_name -> job_archive.JobArchiveNextParam
13, // 7: job.JobNextParam.restore:type_name -> job_restore.JobRestoreNextParam
2, // 8: job.CreatableJob.param:type_name -> job.JobParam
0, // 9: job.JobFilter.status:type_name -> job.JobStatus
14, // 10: job.JobDisplay.archive:type_name -> job_archive.JobArchiveDisplay
15, // 11: job.JobDisplay.restore:type_name -> job_restore.JobRestoreDisplay
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_job_proto_init() }
@@ -661,6 +741,7 @@ func file_job_proto_init() {
return
}
file_job_archive_proto_init()
file_job_restore_proto_init()
if !protoimpl.UnsafeEnabled {
file_job_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*Job); i {
@@ -749,16 +830,20 @@ func file_job_proto_init() {
}
file_job_proto_msgTypes[1].OneofWrappers = []interface{}{
(*JobParam_Archive)(nil),
(*JobParam_Restore)(nil),
}
file_job_proto_msgTypes[2].OneofWrappers = []interface{}{
(*JobState_Archive)(nil),
(*JobState_Restore)(nil),
}
file_job_proto_msgTypes[3].OneofWrappers = []interface{}{
(*JobNextParam_Archive)(nil),
(*JobNextParam_Restore)(nil),
}
file_job_proto_msgTypes[5].OneofWrappers = []interface{}{}
file_job_proto_msgTypes[6].OneofWrappers = []interface{}{
(*JobDisplay_Archive)(nil),
(*JobDisplay_Restore)(nil),
}
type x struct{}
out := protoimpl.TypeBuilder{
+14 -9
View File
@@ -3,15 +3,16 @@ package job;
option go_package = "github.com/abc950309/tapewriter/entity";
import "job_archive.proto";
import "job_restore.proto";
enum JobStatus {
Draft = 0;
NotReady = 1; // dependencies not satisfied
Pending = 2; // waiting in queue
Processing = 3;
Completed = 4;
DRAFT = 0;
NOT_READY = 1; // dependencies not satisfied
PENDING = 2; // waiting in queue
PROCESSING = 3;
COMPLETED = 4;
Failed = 255;
FAILED = 255;
}
message Job {
@@ -26,19 +27,22 @@ message Job {
message JobParam {
oneof param {
job_archive.JobParamArchive Archive = 1;
job_archive.JobArchiveParam archive = 1;
job_restore.JobRestoreParam restore = 2;
}
}
message JobState {
oneof state {
job_archive.JobStateArchive Archive = 1;
job_archive.JobArchiveState archive = 1;
job_restore.JobRestoreState restore = 2;
}
}
message JobNextParam {
oneof param {
job_archive.JobArchiveNextParam archive = 1;
job_restore.JobRestoreNextParam restore = 2;
}
}
@@ -56,6 +60,7 @@ message JobFilter {
message JobDisplay {
oneof display {
job_archive.JobDisplayArchive archive = 1;
job_archive.JobArchiveDisplay archive = 1;
job_restore.JobRestoreDisplay restore = 2;
}
}
+122 -122
View File
@@ -23,25 +23,25 @@ const (
type JobArchiveStep int32
const (
JobArchiveStep_Pending JobArchiveStep = 0
JobArchiveStep_WaitForTape JobArchiveStep = 1
JobArchiveStep_Copying JobArchiveStep = 2
JobArchiveStep_Finished JobArchiveStep = 255
JobArchiveStep_PENDING JobArchiveStep = 0
JobArchiveStep_WAIT_FOR_TAPE JobArchiveStep = 1
JobArchiveStep_COPYING JobArchiveStep = 2
JobArchiveStep_FINISHED JobArchiveStep = 255
)
// Enum value maps for JobArchiveStep.
var (
JobArchiveStep_name = map[int32]string{
0: "Pending",
1: "WaitForTape",
2: "Copying",
255: "Finished",
0: "PENDING",
1: "WAIT_FOR_TAPE",
2: "COPYING",
255: "FINISHED",
}
JobArchiveStep_value = map[string]int32{
"Pending": 0,
"WaitForTape": 1,
"Copying": 2,
"Finished": 255,
"PENDING": 0,
"WAIT_FOR_TAPE": 1,
"COPYING": 2,
"FINISHED": 255,
}
)
@@ -72,7 +72,7 @@ func (JobArchiveStep) EnumDescriptor() ([]byte, []int) {
return file_job_archive_proto_rawDescGZIP(), []int{0}
}
type JobParamArchive struct {
type JobArchiveParam struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
@@ -80,8 +80,8 @@ type JobParamArchive struct {
Sources []*Source `protobuf:"bytes,1,rep,name=sources,proto3" json:"sources,omitempty"`
}
func (x *JobParamArchive) Reset() {
*x = JobParamArchive{}
func (x *JobArchiveParam) Reset() {
*x = JobArchiveParam{}
if protoimpl.UnsafeEnabled {
mi := &file_job_archive_proto_msgTypes[0]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
@@ -89,13 +89,13 @@ func (x *JobParamArchive) Reset() {
}
}
func (x *JobParamArchive) String() string {
func (x *JobArchiveParam) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*JobParamArchive) ProtoMessage() {}
func (*JobArchiveParam) ProtoMessage() {}
func (x *JobParamArchive) ProtoReflect() protoreflect.Message {
func (x *JobArchiveParam) ProtoReflect() protoreflect.Message {
mi := &file_job_archive_proto_msgTypes[0]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
@@ -107,12 +107,12 @@ func (x *JobParamArchive) ProtoReflect() protoreflect.Message {
return mi.MessageOf(x)
}
// Deprecated: Use JobParamArchive.ProtoReflect.Descriptor instead.
func (*JobParamArchive) Descriptor() ([]byte, []int) {
// Deprecated: Use JobArchiveParam.ProtoReflect.Descriptor instead.
func (*JobArchiveParam) Descriptor() ([]byte, []int) {
return file_job_archive_proto_rawDescGZIP(), []int{0}
}
func (x *JobParamArchive) GetSources() []*Source {
func (x *JobArchiveParam) GetSources() []*Source {
if x != nil {
return x.Sources
}
@@ -196,15 +196,15 @@ type isJobArchiveNextParam_Param interface {
}
type JobArchiveNextParam_WaitForTape struct {
WaitForTape *JobArchiveWaitForTapeParam `protobuf:"bytes,1,opt,name=WaitForTape,proto3,oneof"`
WaitForTape *JobArchiveWaitForTapeParam `protobuf:"bytes,1,opt,name=wait_for_tape,json=waitForTape,proto3,oneof"`
}
type JobArchiveNextParam_Copying struct {
Copying *JobArchiveCopyingParam `protobuf:"bytes,2,opt,name=Copying,proto3,oneof"`
Copying *JobArchiveCopyingParam `protobuf:"bytes,2,opt,name=copying,proto3,oneof"`
}
type JobArchiveNextParam_Finished struct {
Finished *JobArchiveFinishedParam `protobuf:"bytes,255,opt,name=Finished,proto3,oneof"`
Finished *JobArchiveFinishedParam `protobuf:"bytes,255,opt,name=finished,proto3,oneof"`
}
func (*JobArchiveNextParam_WaitForTape) isJobArchiveNextParam_Param() {}
@@ -352,7 +352,7 @@ func (*JobArchiveFinishedParam) Descriptor() ([]byte, []int) {
return file_job_archive_proto_rawDescGZIP(), []int{4}
}
type JobStateArchive struct {
type JobArchiveState struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
@@ -361,8 +361,8 @@ type JobStateArchive struct {
Sources []*SourceState `protobuf:"bytes,2,rep,name=sources,proto3" json:"sources,omitempty"`
}
func (x *JobStateArchive) Reset() {
*x = JobStateArchive{}
func (x *JobArchiveState) Reset() {
*x = JobArchiveState{}
if protoimpl.UnsafeEnabled {
mi := &file_job_archive_proto_msgTypes[5]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
@@ -370,13 +370,13 @@ func (x *JobStateArchive) Reset() {
}
}
func (x *JobStateArchive) String() string {
func (x *JobArchiveState) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*JobStateArchive) ProtoMessage() {}
func (*JobArchiveState) ProtoMessage() {}
func (x *JobStateArchive) ProtoReflect() protoreflect.Message {
func (x *JobArchiveState) ProtoReflect() protoreflect.Message {
mi := &file_job_archive_proto_msgTypes[5]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
@@ -388,40 +388,40 @@ func (x *JobStateArchive) ProtoReflect() protoreflect.Message {
return mi.MessageOf(x)
}
// Deprecated: Use JobStateArchive.ProtoReflect.Descriptor instead.
func (*JobStateArchive) Descriptor() ([]byte, []int) {
// Deprecated: Use JobArchiveState.ProtoReflect.Descriptor instead.
func (*JobArchiveState) Descriptor() ([]byte, []int) {
return file_job_archive_proto_rawDescGZIP(), []int{5}
}
func (x *JobStateArchive) GetStep() JobArchiveStep {
func (x *JobArchiveState) GetStep() JobArchiveStep {
if x != nil {
return x.Step
}
return JobArchiveStep_Pending
return JobArchiveStep_PENDING
}
func (x *JobStateArchive) GetSources() []*SourceState {
func (x *JobArchiveState) GetSources() []*SourceState {
if x != nil {
return x.Sources
}
return nil
}
type JobDisplayArchive struct {
type JobArchiveDisplay struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
CopyedBytes int64 `protobuf:"varint,1,opt,name=copyedBytes,proto3" json:"copyedBytes,omitempty"`
CopyedFiles int64 `protobuf:"varint,2,opt,name=copyedFiles,proto3" json:"copyedFiles,omitempty"`
TotalBytes int64 `protobuf:"varint,3,opt,name=totalBytes,proto3" json:"totalBytes,omitempty"`
TotalFiles int64 `protobuf:"varint,4,opt,name=totalFiles,proto3" json:"totalFiles,omitempty"`
CopyedBytes int64 `protobuf:"varint,1,opt,name=copyed_bytes,json=copyedBytes,proto3" json:"copyed_bytes,omitempty"`
CopyedFiles int64 `protobuf:"varint,2,opt,name=copyed_files,json=copyedFiles,proto3" json:"copyed_files,omitempty"`
TotalBytes int64 `protobuf:"varint,3,opt,name=total_bytes,json=totalBytes,proto3" json:"total_bytes,omitempty"`
TotalFiles int64 `protobuf:"varint,4,opt,name=total_files,json=totalFiles,proto3" json:"total_files,omitempty"`
Speed *int64 `protobuf:"varint,5,opt,name=speed,proto3,oneof" json:"speed,omitempty"`
StartTime int64 `protobuf:"varint,6,opt,name=startTime,proto3" json:"startTime,omitempty"`
StartTime int64 `protobuf:"varint,6,opt,name=start_time,json=startTime,proto3" json:"start_time,omitempty"`
}
func (x *JobDisplayArchive) Reset() {
*x = JobDisplayArchive{}
func (x *JobArchiveDisplay) Reset() {
*x = JobArchiveDisplay{}
if protoimpl.UnsafeEnabled {
mi := &file_job_archive_proto_msgTypes[6]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
@@ -429,13 +429,13 @@ func (x *JobDisplayArchive) Reset() {
}
}
func (x *JobDisplayArchive) String() string {
func (x *JobArchiveDisplay) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*JobDisplayArchive) ProtoMessage() {}
func (*JobArchiveDisplay) ProtoMessage() {}
func (x *JobDisplayArchive) ProtoReflect() protoreflect.Message {
func (x *JobArchiveDisplay) ProtoReflect() protoreflect.Message {
mi := &file_job_archive_proto_msgTypes[6]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
@@ -447,47 +447,47 @@ func (x *JobDisplayArchive) ProtoReflect() protoreflect.Message {
return mi.MessageOf(x)
}
// Deprecated: Use JobDisplayArchive.ProtoReflect.Descriptor instead.
func (*JobDisplayArchive) Descriptor() ([]byte, []int) {
// Deprecated: Use JobArchiveDisplay.ProtoReflect.Descriptor instead.
func (*JobArchiveDisplay) Descriptor() ([]byte, []int) {
return file_job_archive_proto_rawDescGZIP(), []int{6}
}
func (x *JobDisplayArchive) GetCopyedBytes() int64 {
func (x *JobArchiveDisplay) GetCopyedBytes() int64 {
if x != nil {
return x.CopyedBytes
}
return 0
}
func (x *JobDisplayArchive) GetCopyedFiles() int64 {
func (x *JobArchiveDisplay) GetCopyedFiles() int64 {
if x != nil {
return x.CopyedFiles
}
return 0
}
func (x *JobDisplayArchive) GetTotalBytes() int64 {
func (x *JobArchiveDisplay) GetTotalBytes() int64 {
if x != nil {
return x.TotalBytes
}
return 0
}
func (x *JobDisplayArchive) GetTotalFiles() int64 {
func (x *JobArchiveDisplay) GetTotalFiles() int64 {
if x != nil {
return x.TotalFiles
}
return 0
}
func (x *JobDisplayArchive) GetSpeed() int64 {
func (x *JobArchiveDisplay) GetSpeed() int64 {
if x != nil && x.Speed != nil {
return *x.Speed
}
return 0
}
func (x *JobDisplayArchive) GetStartTime() int64 {
func (x *JobArchiveDisplay) GetStartTime() int64 {
if x != nil {
return x.StartTime
}
@@ -500,64 +500,64 @@ var file_job_archive_proto_rawDesc = []byte{
0x0a, 0x11, 0x6a, 0x6f, 0x62, 0x5f, 0x61, 0x72, 0x63, 0x68, 0x69, 0x76, 0x65, 0x2e, 0x70, 0x72,
0x6f, 0x74, 0x6f, 0x12, 0x0b, 0x6a, 0x6f, 0x62, 0x5f, 0x61, 0x72, 0x63, 0x68, 0x69, 0x76, 0x65,
0x1a, 0x0c, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x3b,
0x0a, 0x0f, 0x4a, 0x6f, 0x62, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x41, 0x72, 0x63, 0x68, 0x69, 0x76,
0x65, 0x12, 0x28, 0x0a, 0x07, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x73, 0x18, 0x01, 0x20, 0x03,
0x0a, 0x0f, 0x4a, 0x6f, 0x62, 0x41, 0x72, 0x63, 0x68, 0x69, 0x76, 0x65, 0x50, 0x61, 0x72, 0x61,
0x6d, 0x12, 0x28, 0x0a, 0x07, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x73, 0x18, 0x01, 0x20, 0x03,
0x28, 0x0b, 0x32, 0x0e, 0x2e, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x2e, 0x53, 0x6f, 0x75, 0x72,
0x63, 0x65, 0x52, 0x07, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x73, 0x22, 0xf1, 0x01, 0x0a, 0x13,
0x63, 0x65, 0x52, 0x07, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x73, 0x22, 0xf3, 0x01, 0x0a, 0x13,
0x4a, 0x6f, 0x62, 0x41, 0x72, 0x63, 0x68, 0x69, 0x76, 0x65, 0x4e, 0x65, 0x78, 0x74, 0x50, 0x61,
0x72, 0x61, 0x6d, 0x12, 0x4b, 0x0a, 0x0b, 0x57, 0x61, 0x69, 0x74, 0x46, 0x6f, 0x72, 0x54, 0x61,
0x70, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x27, 0x2e, 0x6a, 0x6f, 0x62, 0x5f, 0x61,
0x72, 0x63, 0x68, 0x69, 0x76, 0x65, 0x2e, 0x4a, 0x6f, 0x62, 0x41, 0x72, 0x63, 0x68, 0x69, 0x76,
0x65, 0x57, 0x61, 0x69, 0x74, 0x46, 0x6f, 0x72, 0x54, 0x61, 0x70, 0x65, 0x50, 0x61, 0x72, 0x61,
0x6d, 0x48, 0x00, 0x52, 0x0b, 0x57, 0x61, 0x69, 0x74, 0x46, 0x6f, 0x72, 0x54, 0x61, 0x70, 0x65,
0x12, 0x3f, 0x0a, 0x07, 0x43, 0x6f, 0x70, 0x79, 0x69, 0x6e, 0x67, 0x18, 0x02, 0x20, 0x01, 0x28,
0x0b, 0x32, 0x23, 0x2e, 0x6a, 0x6f, 0x62, 0x5f, 0x61, 0x72, 0x63, 0x68, 0x69, 0x76, 0x65, 0x2e,
0x4a, 0x6f, 0x62, 0x41, 0x72, 0x63, 0x68, 0x69, 0x76, 0x65, 0x43, 0x6f, 0x70, 0x79, 0x69, 0x6e,
0x67, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x48, 0x00, 0x52, 0x07, 0x43, 0x6f, 0x70, 0x79, 0x69, 0x6e,
0x67, 0x12, 0x43, 0x0a, 0x08, 0x46, 0x69, 0x6e, 0x69, 0x73, 0x68, 0x65, 0x64, 0x18, 0xff, 0x01,
0x20, 0x01, 0x28, 0x0b, 0x32, 0x24, 0x2e, 0x6a, 0x6f, 0x62, 0x5f, 0x61, 0x72, 0x63, 0x68, 0x69,
0x76, 0x65, 0x2e, 0x4a, 0x6f, 0x62, 0x41, 0x72, 0x63, 0x68, 0x69, 0x76, 0x65, 0x46, 0x69, 0x6e,
0x69, 0x73, 0x68, 0x65, 0x64, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x48, 0x00, 0x52, 0x08, 0x46, 0x69,
0x6e, 0x69, 0x73, 0x68, 0x65, 0x64, 0x42, 0x07, 0x0a, 0x05, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x22,
0x1c, 0x0a, 0x1a, 0x4a, 0x6f, 0x62, 0x41, 0x72, 0x63, 0x68, 0x69, 0x76, 0x65, 0x57, 0x61, 0x69,
0x74, 0x46, 0x6f, 0x72, 0x54, 0x61, 0x70, 0x65, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x22, 0x5e, 0x0a,
0x16, 0x4a, 0x6f, 0x62, 0x41, 0x72, 0x63, 0x68, 0x69, 0x76, 0x65, 0x43, 0x6f, 0x70, 0x79, 0x69,
0x6e, 0x67, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x12, 0x16, 0x0a, 0x06, 0x64, 0x65, 0x76, 0x69, 0x63,
0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x64, 0x65, 0x76, 0x69, 0x63, 0x65, 0x12,
0x18, 0x0a, 0x07, 0x62, 0x61, 0x72, 0x63, 0x6f, 0x64, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09,
0x52, 0x07, 0x62, 0x61, 0x72, 0x63, 0x6f, 0x64, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d,
0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x22, 0x19, 0x0a,
0x17, 0x4a, 0x6f, 0x62, 0x41, 0x72, 0x63, 0x68, 0x69, 0x76, 0x65, 0x46, 0x69, 0x6e, 0x69, 0x73,
0x68, 0x65, 0x64, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x22, 0x71, 0x0a, 0x0f, 0x4a, 0x6f, 0x62, 0x53,
0x74, 0x61, 0x74, 0x65, 0x41, 0x72, 0x63, 0x68, 0x69, 0x76, 0x65, 0x12, 0x2f, 0x0a, 0x04, 0x73,
0x74, 0x65, 0x70, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x1b, 0x2e, 0x6a, 0x6f, 0x62, 0x5f,
0x61, 0x72, 0x63, 0x68, 0x69, 0x76, 0x65, 0x2e, 0x4a, 0x6f, 0x62, 0x41, 0x72, 0x63, 0x68, 0x69,
0x76, 0x65, 0x53, 0x74, 0x65, 0x70, 0x52, 0x04, 0x73, 0x74, 0x65, 0x70, 0x12, 0x2d, 0x0a, 0x07,
0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x13, 0x2e,
0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x2e, 0x53, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x53, 0x74, 0x61,
0x74, 0x65, 0x52, 0x07, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x73, 0x22, 0xda, 0x01, 0x0a, 0x11,
0x4a, 0x6f, 0x62, 0x44, 0x69, 0x73, 0x70, 0x6c, 0x61, 0x79, 0x41, 0x72, 0x63, 0x68, 0x69, 0x76,
0x65, 0x12, 0x20, 0x0a, 0x0b, 0x63, 0x6f, 0x70, 0x79, 0x65, 0x64, 0x42, 0x79, 0x74, 0x65, 0x73,
0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x0b, 0x63, 0x6f, 0x70, 0x79, 0x65, 0x64, 0x42, 0x79,
0x74, 0x65, 0x73, 0x12, 0x20, 0x0a, 0x0b, 0x63, 0x6f, 0x70, 0x79, 0x65, 0x64, 0x46, 0x69, 0x6c,
0x65, 0x73, 0x18, 0x02, 0x20, 0x01, 0x28, 0x03, 0x52, 0x0b, 0x63, 0x6f, 0x70, 0x79, 0x65, 0x64,
0x46, 0x69, 0x6c, 0x65, 0x73, 0x12, 0x1e, 0x0a, 0x0a, 0x74, 0x6f, 0x74, 0x61, 0x6c, 0x42, 0x79,
0x74, 0x65, 0x73, 0x18, 0x03, 0x20, 0x01, 0x28, 0x03, 0x52, 0x0a, 0x74, 0x6f, 0x74, 0x61, 0x6c,
0x42, 0x79, 0x74, 0x65, 0x73, 0x12, 0x1e, 0x0a, 0x0a, 0x74, 0x6f, 0x74, 0x61, 0x6c, 0x46, 0x69,
0x6c, 0x65, 0x73, 0x18, 0x04, 0x20, 0x01, 0x28, 0x03, 0x52, 0x0a, 0x74, 0x6f, 0x74, 0x61, 0x6c,
0x46, 0x69, 0x6c, 0x65, 0x73, 0x12, 0x19, 0x0a, 0x05, 0x73, 0x70, 0x65, 0x65, 0x64, 0x18, 0x05,
0x20, 0x01, 0x28, 0x03, 0x48, 0x00, 0x52, 0x05, 0x73, 0x70, 0x65, 0x65, 0x64, 0x88, 0x01, 0x01,
0x12, 0x1c, 0x0a, 0x09, 0x73, 0x74, 0x61, 0x72, 0x74, 0x54, 0x69, 0x6d, 0x65, 0x18, 0x06, 0x20,
0x01, 0x28, 0x03, 0x52, 0x09, 0x73, 0x74, 0x61, 0x72, 0x74, 0x54, 0x69, 0x6d, 0x65, 0x42, 0x08,
0x0a, 0x06, 0x5f, 0x73, 0x70, 0x65, 0x65, 0x64, 0x2a, 0x4a, 0x0a, 0x0e, 0x4a, 0x6f, 0x62, 0x41,
0x72, 0x63, 0x68, 0x69, 0x76, 0x65, 0x53, 0x74, 0x65, 0x70, 0x12, 0x0b, 0x0a, 0x07, 0x50, 0x65,
0x6e, 0x64, 0x69, 0x6e, 0x67, 0x10, 0x00, 0x12, 0x0f, 0x0a, 0x0b, 0x57, 0x61, 0x69, 0x74, 0x46,
0x6f, 0x72, 0x54, 0x61, 0x70, 0x65, 0x10, 0x01, 0x12, 0x0b, 0x0a, 0x07, 0x43, 0x6f, 0x70, 0x79,
0x69, 0x6e, 0x67, 0x10, 0x02, 0x12, 0x0d, 0x0a, 0x08, 0x46, 0x69, 0x6e, 0x69, 0x73, 0x68, 0x65,
0x64, 0x10, 0xff, 0x01, 0x42, 0x28, 0x5a, 0x26, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63,
0x6f, 0x6d, 0x2f, 0x61, 0x62, 0x63, 0x39, 0x35, 0x30, 0x33, 0x30, 0x39, 0x2f, 0x74, 0x61, 0x70,
0x65, 0x77, 0x72, 0x69, 0x74, 0x65, 0x72, 0x2f, 0x65, 0x6e, 0x74, 0x69, 0x74, 0x79, 0x62, 0x06,
0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
0x72, 0x61, 0x6d, 0x12, 0x4d, 0x0a, 0x0d, 0x77, 0x61, 0x69, 0x74, 0x5f, 0x66, 0x6f, 0x72, 0x5f,
0x74, 0x61, 0x70, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x27, 0x2e, 0x6a, 0x6f, 0x62,
0x5f, 0x61, 0x72, 0x63, 0x68, 0x69, 0x76, 0x65, 0x2e, 0x4a, 0x6f, 0x62, 0x41, 0x72, 0x63, 0x68,
0x69, 0x76, 0x65, 0x57, 0x61, 0x69, 0x74, 0x46, 0x6f, 0x72, 0x54, 0x61, 0x70, 0x65, 0x50, 0x61,
0x72, 0x61, 0x6d, 0x48, 0x00, 0x52, 0x0b, 0x77, 0x61, 0x69, 0x74, 0x46, 0x6f, 0x72, 0x54, 0x61,
0x70, 0x65, 0x12, 0x3f, 0x0a, 0x07, 0x63, 0x6f, 0x70, 0x79, 0x69, 0x6e, 0x67, 0x18, 0x02, 0x20,
0x01, 0x28, 0x0b, 0x32, 0x23, 0x2e, 0x6a, 0x6f, 0x62, 0x5f, 0x61, 0x72, 0x63, 0x68, 0x69, 0x76,
0x65, 0x2e, 0x4a, 0x6f, 0x62, 0x41, 0x72, 0x63, 0x68, 0x69, 0x76, 0x65, 0x43, 0x6f, 0x70, 0x79,
0x69, 0x6e, 0x67, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x48, 0x00, 0x52, 0x07, 0x63, 0x6f, 0x70, 0x79,
0x69, 0x6e, 0x67, 0x12, 0x43, 0x0a, 0x08, 0x66, 0x69, 0x6e, 0x69, 0x73, 0x68, 0x65, 0x64, 0x18,
0xff, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x24, 0x2e, 0x6a, 0x6f, 0x62, 0x5f, 0x61, 0x72, 0x63,
0x68, 0x69, 0x76, 0x65, 0x2e, 0x4a, 0x6f, 0x62, 0x41, 0x72, 0x63, 0x68, 0x69, 0x76, 0x65, 0x46,
0x69, 0x6e, 0x69, 0x73, 0x68, 0x65, 0x64, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x48, 0x00, 0x52, 0x08,
0x66, 0x69, 0x6e, 0x69, 0x73, 0x68, 0x65, 0x64, 0x42, 0x07, 0x0a, 0x05, 0x70, 0x61, 0x72, 0x61,
0x6d, 0x22, 0x1c, 0x0a, 0x1a, 0x4a, 0x6f, 0x62, 0x41, 0x72, 0x63, 0x68, 0x69, 0x76, 0x65, 0x57,
0x61, 0x69, 0x74, 0x46, 0x6f, 0x72, 0x54, 0x61, 0x70, 0x65, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x22,
0x5e, 0x0a, 0x16, 0x4a, 0x6f, 0x62, 0x41, 0x72, 0x63, 0x68, 0x69, 0x76, 0x65, 0x43, 0x6f, 0x70,
0x79, 0x69, 0x6e, 0x67, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x12, 0x16, 0x0a, 0x06, 0x64, 0x65, 0x76,
0x69, 0x63, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x64, 0x65, 0x76, 0x69, 0x63,
0x65, 0x12, 0x18, 0x0a, 0x07, 0x62, 0x61, 0x72, 0x63, 0x6f, 0x64, 0x65, 0x18, 0x02, 0x20, 0x01,
0x28, 0x09, 0x52, 0x07, 0x62, 0x61, 0x72, 0x63, 0x6f, 0x64, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x6e,
0x61, 0x6d, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x22,
0x19, 0x0a, 0x17, 0x4a, 0x6f, 0x62, 0x41, 0x72, 0x63, 0x68, 0x69, 0x76, 0x65, 0x46, 0x69, 0x6e,
0x69, 0x73, 0x68, 0x65, 0x64, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x22, 0x71, 0x0a, 0x0f, 0x4a, 0x6f,
0x62, 0x41, 0x72, 0x63, 0x68, 0x69, 0x76, 0x65, 0x53, 0x74, 0x61, 0x74, 0x65, 0x12, 0x2f, 0x0a,
0x04, 0x73, 0x74, 0x65, 0x70, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x1b, 0x2e, 0x6a, 0x6f,
0x62, 0x5f, 0x61, 0x72, 0x63, 0x68, 0x69, 0x76, 0x65, 0x2e, 0x4a, 0x6f, 0x62, 0x41, 0x72, 0x63,
0x68, 0x69, 0x76, 0x65, 0x53, 0x74, 0x65, 0x70, 0x52, 0x04, 0x73, 0x74, 0x65, 0x70, 0x12, 0x2d,
0x0a, 0x07, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32,
0x13, 0x2e, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x2e, 0x53, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x53,
0x74, 0x61, 0x74, 0x65, 0x52, 0x07, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x73, 0x22, 0xdf, 0x01,
0x0a, 0x11, 0x4a, 0x6f, 0x62, 0x41, 0x72, 0x63, 0x68, 0x69, 0x76, 0x65, 0x44, 0x69, 0x73, 0x70,
0x6c, 0x61, 0x79, 0x12, 0x21, 0x0a, 0x0c, 0x63, 0x6f, 0x70, 0x79, 0x65, 0x64, 0x5f, 0x62, 0x79,
0x74, 0x65, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x0b, 0x63, 0x6f, 0x70, 0x79, 0x65,
0x64, 0x42, 0x79, 0x74, 0x65, 0x73, 0x12, 0x21, 0x0a, 0x0c, 0x63, 0x6f, 0x70, 0x79, 0x65, 0x64,
0x5f, 0x66, 0x69, 0x6c, 0x65, 0x73, 0x18, 0x02, 0x20, 0x01, 0x28, 0x03, 0x52, 0x0b, 0x63, 0x6f,
0x70, 0x79, 0x65, 0x64, 0x46, 0x69, 0x6c, 0x65, 0x73, 0x12, 0x1f, 0x0a, 0x0b, 0x74, 0x6f, 0x74,
0x61, 0x6c, 0x5f, 0x62, 0x79, 0x74, 0x65, 0x73, 0x18, 0x03, 0x20, 0x01, 0x28, 0x03, 0x52, 0x0a,
0x74, 0x6f, 0x74, 0x61, 0x6c, 0x42, 0x79, 0x74, 0x65, 0x73, 0x12, 0x1f, 0x0a, 0x0b, 0x74, 0x6f,
0x74, 0x61, 0x6c, 0x5f, 0x66, 0x69, 0x6c, 0x65, 0x73, 0x18, 0x04, 0x20, 0x01, 0x28, 0x03, 0x52,
0x0a, 0x74, 0x6f, 0x74, 0x61, 0x6c, 0x46, 0x69, 0x6c, 0x65, 0x73, 0x12, 0x19, 0x0a, 0x05, 0x73,
0x70, 0x65, 0x65, 0x64, 0x18, 0x05, 0x20, 0x01, 0x28, 0x03, 0x48, 0x00, 0x52, 0x05, 0x73, 0x70,
0x65, 0x65, 0x64, 0x88, 0x01, 0x01, 0x12, 0x1d, 0x0a, 0x0a, 0x73, 0x74, 0x61, 0x72, 0x74, 0x5f,
0x74, 0x69, 0x6d, 0x65, 0x18, 0x06, 0x20, 0x01, 0x28, 0x03, 0x52, 0x09, 0x73, 0x74, 0x61, 0x72,
0x74, 0x54, 0x69, 0x6d, 0x65, 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x73, 0x70, 0x65, 0x65, 0x64, 0x2a,
0x4c, 0x0a, 0x0e, 0x4a, 0x6f, 0x62, 0x41, 0x72, 0x63, 0x68, 0x69, 0x76, 0x65, 0x53, 0x74, 0x65,
0x70, 0x12, 0x0b, 0x0a, 0x07, 0x50, 0x45, 0x4e, 0x44, 0x49, 0x4e, 0x47, 0x10, 0x00, 0x12, 0x11,
0x0a, 0x0d, 0x57, 0x41, 0x49, 0x54, 0x5f, 0x46, 0x4f, 0x52, 0x5f, 0x54, 0x41, 0x50, 0x45, 0x10,
0x01, 0x12, 0x0b, 0x0a, 0x07, 0x43, 0x4f, 0x50, 0x59, 0x49, 0x4e, 0x47, 0x10, 0x02, 0x12, 0x0d,
0x0a, 0x08, 0x46, 0x49, 0x4e, 0x49, 0x53, 0x48, 0x45, 0x44, 0x10, 0xff, 0x01, 0x42, 0x28, 0x5a,
0x26, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x61, 0x62, 0x63, 0x39,
0x35, 0x30, 0x33, 0x30, 0x39, 0x2f, 0x74, 0x61, 0x70, 0x65, 0x77, 0x72, 0x69, 0x74, 0x65, 0x72,
0x2f, 0x65, 0x6e, 0x74, 0x69, 0x74, 0x79, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
}
var (
@@ -576,23 +576,23 @@ var file_job_archive_proto_enumTypes = make([]protoimpl.EnumInfo, 1)
var file_job_archive_proto_msgTypes = make([]protoimpl.MessageInfo, 7)
var file_job_archive_proto_goTypes = []interface{}{
(JobArchiveStep)(0), // 0: job_archive.JobArchiveStep
(*JobParamArchive)(nil), // 1: job_archive.JobParamArchive
(*JobArchiveParam)(nil), // 1: job_archive.JobArchiveParam
(*JobArchiveNextParam)(nil), // 2: job_archive.JobArchiveNextParam
(*JobArchiveWaitForTapeParam)(nil), // 3: job_archive.JobArchiveWaitForTapeParam
(*JobArchiveCopyingParam)(nil), // 4: job_archive.JobArchiveCopyingParam
(*JobArchiveFinishedParam)(nil), // 5: job_archive.JobArchiveFinishedParam
(*JobStateArchive)(nil), // 6: job_archive.JobStateArchive
(*JobDisplayArchive)(nil), // 7: job_archive.JobDisplayArchive
(*JobArchiveState)(nil), // 6: job_archive.JobArchiveState
(*JobArchiveDisplay)(nil), // 7: job_archive.JobArchiveDisplay
(*Source)(nil), // 8: source.Source
(*SourceState)(nil), // 9: source.SourceState
}
var file_job_archive_proto_depIdxs = []int32{
8, // 0: job_archive.JobParamArchive.sources:type_name -> source.Source
3, // 1: job_archive.JobArchiveNextParam.WaitForTape:type_name -> job_archive.JobArchiveWaitForTapeParam
4, // 2: job_archive.JobArchiveNextParam.Copying:type_name -> job_archive.JobArchiveCopyingParam
5, // 3: job_archive.JobArchiveNextParam.Finished:type_name -> job_archive.JobArchiveFinishedParam
0, // 4: job_archive.JobStateArchive.step:type_name -> job_archive.JobArchiveStep
9, // 5: job_archive.JobStateArchive.sources:type_name -> source.SourceState
8, // 0: job_archive.JobArchiveParam.sources:type_name -> source.Source
3, // 1: job_archive.JobArchiveNextParam.wait_for_tape:type_name -> job_archive.JobArchiveWaitForTapeParam
4, // 2: job_archive.JobArchiveNextParam.copying:type_name -> job_archive.JobArchiveCopyingParam
5, // 3: job_archive.JobArchiveNextParam.finished:type_name -> job_archive.JobArchiveFinishedParam
0, // 4: job_archive.JobArchiveState.step:type_name -> job_archive.JobArchiveStep
9, // 5: job_archive.JobArchiveState.sources:type_name -> source.SourceState
6, // [6:6] is the sub-list for method output_type
6, // [6:6] is the sub-list for method input_type
6, // [6:6] is the sub-list for extension type_name
@@ -608,7 +608,7 @@ func file_job_archive_proto_init() {
file_source_proto_init()
if !protoimpl.UnsafeEnabled {
file_job_archive_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*JobParamArchive); i {
switch v := v.(*JobArchiveParam); i {
case 0:
return &v.state
case 1:
@@ -668,7 +668,7 @@ func file_job_archive_proto_init() {
}
}
file_job_archive_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*JobStateArchive); i {
switch v := v.(*JobArchiveState); i {
case 0:
return &v.state
case 1:
@@ -680,7 +680,7 @@ func file_job_archive_proto_init() {
}
}
file_job_archive_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*JobDisplayArchive); i {
switch v := v.(*JobArchiveDisplay); i {
case 0:
return &v.state
case 1:
+15 -15
View File
@@ -5,22 +5,22 @@ option go_package = "github.com/abc950309/tapewriter/entity";
import "source.proto";
enum JobArchiveStep {
Pending = 0;
WaitForTape = 1;
Copying = 2;
PENDING = 0;
WAIT_FOR_TAPE = 1;
COPYING = 2;
Finished = 255;
FINISHED = 255;
}
message JobParamArchive {
message JobArchiveParam {
repeated source.Source sources = 1;
}
message JobArchiveNextParam {
oneof param {
JobArchiveWaitForTapeParam WaitForTape = 1;
JobArchiveCopyingParam Copying = 2;
JobArchiveFinishedParam Finished = 255;
JobArchiveWaitForTapeParam wait_for_tape = 1;
JobArchiveCopyingParam copying = 2;
JobArchiveFinishedParam finished = 255;
}
}
@@ -34,17 +34,17 @@ message JobArchiveCopyingParam {
message JobArchiveFinishedParam {}
message JobStateArchive {
message JobArchiveState {
JobArchiveStep step = 1;
repeated source.SourceState sources = 2;
}
message JobDisplayArchive {
int64 copyedBytes = 1;
int64 copyedFiles = 2;
int64 totalBytes = 3;
int64 totalFiles = 4;
message JobArchiveDisplay {
int64 copyed_bytes = 1;
int64 copyed_files = 2;
int64 total_bytes = 3;
int64 total_files = 4;
optional int64 speed = 5;
int64 startTime = 6;
int64 start_time = 6;
}
+301 -164
View File
@@ -23,25 +23,25 @@ const (
type JobRestoreStep int32
const (
JobRestoreStep_Pending JobRestoreStep = 0
JobRestoreStep_WaitForTape JobRestoreStep = 1
JobRestoreStep_Copying JobRestoreStep = 2
JobRestoreStep_Finished JobRestoreStep = 255
JobRestoreStep_PENDING JobRestoreStep = 0
JobRestoreStep_WAIT_FOR_TAPE JobRestoreStep = 1
JobRestoreStep_COPYING JobRestoreStep = 2
JobRestoreStep_FINISHED JobRestoreStep = 255
)
// Enum value maps for JobRestoreStep.
var (
JobRestoreStep_name = map[int32]string{
0: "Pending",
1: "WaitForTape",
2: "Copying",
255: "Finished",
0: "PENDING",
1: "WAIT_FOR_TAPE",
2: "COPYING",
255: "FINISHED",
}
JobRestoreStep_value = map[string]int32{
"Pending": 0,
"WaitForTape": 1,
"Copying": 2,
"Finished": 255,
"PENDING": 0,
"WAIT_FOR_TAPE": 1,
"COPYING": 2,
"FINISHED": 255,
}
)
@@ -72,7 +72,7 @@ func (JobRestoreStep) EnumDescriptor() ([]byte, []int) {
return file_job_restore_proto_rawDescGZIP(), []int{0}
}
type JobParamRestore struct {
type JobRestoreParam struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
@@ -80,8 +80,8 @@ type JobParamRestore struct {
FileIds []int64 `protobuf:"varint,1,rep,packed,name=file_ids,json=fileIds,proto3" json:"file_ids,omitempty"`
}
func (x *JobParamRestore) Reset() {
*x = JobParamRestore{}
func (x *JobRestoreParam) Reset() {
*x = JobRestoreParam{}
if protoimpl.UnsafeEnabled {
mi := &file_job_restore_proto_msgTypes[0]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
@@ -89,13 +89,13 @@ func (x *JobParamRestore) Reset() {
}
}
func (x *JobParamRestore) String() string {
func (x *JobRestoreParam) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*JobParamRestore) ProtoMessage() {}
func (*JobRestoreParam) ProtoMessage() {}
func (x *JobParamRestore) ProtoReflect() protoreflect.Message {
func (x *JobRestoreParam) ProtoReflect() protoreflect.Message {
mi := &file_job_restore_proto_msgTypes[0]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
@@ -107,12 +107,12 @@ func (x *JobParamRestore) ProtoReflect() protoreflect.Message {
return mi.MessageOf(x)
}
// Deprecated: Use JobParamRestore.ProtoReflect.Descriptor instead.
func (*JobParamRestore) Descriptor() ([]byte, []int) {
// Deprecated: Use JobRestoreParam.ProtoReflect.Descriptor instead.
func (*JobRestoreParam) Descriptor() ([]byte, []int) {
return file_job_restore_proto_rawDescGZIP(), []int{0}
}
func (x *JobParamRestore) GetFileIds() []int64 {
func (x *JobRestoreParam) GetFileIds() []int64 {
if x != nil {
return x.FileIds
}
@@ -196,15 +196,15 @@ type isJobRestoreNextParam_Param interface {
}
type JobRestoreNextParam_WaitForTape struct {
WaitForTape *JobRestoreWaitForTapeParam `protobuf:"bytes,1,opt,name=WaitForTape,proto3,oneof"`
WaitForTape *JobRestoreWaitForTapeParam `protobuf:"bytes,1,opt,name=wait_for_tape,json=waitForTape,proto3,oneof"`
}
type JobRestoreNextParam_Copying struct {
Copying *JobRestoreCopyingParam `protobuf:"bytes,2,opt,name=Copying,proto3,oneof"`
Copying *JobRestoreCopyingParam `protobuf:"bytes,2,opt,name=copying,proto3,oneof"`
}
type JobRestoreNextParam_Finished struct {
Finished *JobRestoreFinishedParam `protobuf:"bytes,255,opt,name=Finished,proto3,oneof"`
Finished *JobRestoreFinishedParam `protobuf:"bytes,255,opt,name=finished,proto3,oneof"`
}
func (*JobRestoreNextParam_WaitForTape) isJobRestoreNextParam_Param() {}
@@ -336,20 +336,22 @@ func (*JobRestoreFinishedParam) Descriptor() ([]byte, []int) {
return file_job_restore_proto_rawDescGZIP(), []int{4}
}
type FileRestoreState struct {
type RestoreFile struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
FileId int64 `protobuf:"varint,1,opt,name=file_id,json=fileId,proto3" json:"file_id,omitempty"`
Status CopyStatus `protobuf:"varint,2,opt,name=status,proto3,enum=copy_status.CopyStatus" json:"status,omitempty"`
TapeId int64 `protobuf:"varint,17,opt,name=tape_id,json=tapeId,proto3" json:"tape_id,omitempty"`
PositionId int64 `protobuf:"varint,18,opt,name=position_id,json=positionId,proto3" json:"position_id,omitempty"`
PathInTape []string `protobuf:"bytes,19,rep,name=path_in_tape,json=pathInTape,proto3" json:"path_in_tape,omitempty"`
TapeId int64 `protobuf:"varint,2,opt,name=tape_id,json=tapeId,proto3" json:"tape_id,omitempty"`
PositionId int64 `protobuf:"varint,3,opt,name=position_id,json=positionId,proto3" json:"position_id,omitempty"`
Status CopyStatus `protobuf:"varint,17,opt,name=status,proto3,enum=copy_status.CopyStatus" json:"status,omitempty"`
Size int64 `protobuf:"varint,18,opt,name=size,proto3" json:"size,omitempty"`
TapePath string `protobuf:"bytes,33,opt,name=tape_path,json=tapePath,proto3" json:"tape_path,omitempty"`
TargetPath string `protobuf:"bytes,34,opt,name=target_path,json=targetPath,proto3" json:"target_path,omitempty"`
}
func (x *FileRestoreState) Reset() {
*x = FileRestoreState{}
func (x *RestoreFile) Reset() {
*x = RestoreFile{}
if protoimpl.UnsafeEnabled {
mi := &file_job_restore_proto_msgTypes[5]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
@@ -357,13 +359,13 @@ func (x *FileRestoreState) Reset() {
}
}
func (x *FileRestoreState) String() string {
func (x *RestoreFile) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*FileRestoreState) ProtoMessage() {}
func (*RestoreFile) ProtoMessage() {}
func (x *FileRestoreState) ProtoReflect() protoreflect.Message {
func (x *RestoreFile) ProtoReflect() protoreflect.Message {
mi := &file_job_restore_proto_msgTypes[5]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
@@ -375,57 +377,73 @@ func (x *FileRestoreState) ProtoReflect() protoreflect.Message {
return mi.MessageOf(x)
}
// Deprecated: Use FileRestoreState.ProtoReflect.Descriptor instead.
func (*FileRestoreState) Descriptor() ([]byte, []int) {
// Deprecated: Use RestoreFile.ProtoReflect.Descriptor instead.
func (*RestoreFile) Descriptor() ([]byte, []int) {
return file_job_restore_proto_rawDescGZIP(), []int{5}
}
func (x *FileRestoreState) GetFileId() int64 {
func (x *RestoreFile) GetFileId() int64 {
if x != nil {
return x.FileId
}
return 0
}
func (x *FileRestoreState) GetStatus() CopyStatus {
if x != nil {
return x.Status
}
return CopyStatus_Draft
}
func (x *FileRestoreState) GetTapeId() int64 {
func (x *RestoreFile) GetTapeId() int64 {
if x != nil {
return x.TapeId
}
return 0
}
func (x *FileRestoreState) GetPositionId() int64 {
func (x *RestoreFile) GetPositionId() int64 {
if x != nil {
return x.PositionId
}
return 0
}
func (x *FileRestoreState) GetPathInTape() []string {
func (x *RestoreFile) GetStatus() CopyStatus {
if x != nil {
return x.PathInTape
return x.Status
}
return nil
return CopyStatus_DRAFT
}
type JobStateRestore struct {
func (x *RestoreFile) GetSize() int64 {
if x != nil {
return x.Size
}
return 0
}
func (x *RestoreFile) GetTapePath() string {
if x != nil {
return x.TapePath
}
return ""
}
func (x *RestoreFile) GetTargetPath() string {
if x != nil {
return x.TargetPath
}
return ""
}
type RestoreTape struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
Step JobRestoreStep `protobuf:"varint,1,opt,name=step,proto3,enum=job_restore.JobRestoreStep" json:"step,omitempty"`
Files []*FileRestoreState `protobuf:"bytes,2,rep,name=files,proto3" json:"files,omitempty"`
TapeId int64 `protobuf:"varint,1,opt,name=tape_id,json=tapeId,proto3" json:"tape_id,omitempty"`
Barcode string `protobuf:"bytes,2,opt,name=barcode,proto3" json:"barcode,omitempty"`
Status CopyStatus `protobuf:"varint,17,opt,name=status,proto3,enum=copy_status.CopyStatus" json:"status,omitempty"`
Files []*RestoreFile `protobuf:"bytes,18,rep,name=files,proto3" json:"files,omitempty"`
}
func (x *JobStateRestore) Reset() {
*x = JobStateRestore{}
func (x *RestoreTape) Reset() {
*x = RestoreTape{}
if protoimpl.UnsafeEnabled {
mi := &file_job_restore_proto_msgTypes[6]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
@@ -433,13 +451,13 @@ func (x *JobStateRestore) Reset() {
}
}
func (x *JobStateRestore) String() string {
func (x *RestoreTape) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*JobStateRestore) ProtoMessage() {}
func (*RestoreTape) ProtoMessage() {}
func (x *JobStateRestore) ProtoReflect() protoreflect.Message {
func (x *RestoreTape) ProtoReflect() protoreflect.Message {
mi := &file_job_restore_proto_msgTypes[6]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
@@ -451,39 +469,50 @@ func (x *JobStateRestore) ProtoReflect() protoreflect.Message {
return mi.MessageOf(x)
}
// Deprecated: Use JobStateRestore.ProtoReflect.Descriptor instead.
func (*JobStateRestore) Descriptor() ([]byte, []int) {
// Deprecated: Use RestoreTape.ProtoReflect.Descriptor instead.
func (*RestoreTape) Descriptor() ([]byte, []int) {
return file_job_restore_proto_rawDescGZIP(), []int{6}
}
func (x *JobStateRestore) GetStep() JobRestoreStep {
func (x *RestoreTape) GetTapeId() int64 {
if x != nil {
return x.Step
return x.TapeId
}
return JobRestoreStep_Pending
return 0
}
func (x *JobStateRestore) GetFiles() []*FileRestoreState {
func (x *RestoreTape) GetBarcode() string {
if x != nil {
return x.Barcode
}
return ""
}
func (x *RestoreTape) GetStatus() CopyStatus {
if x != nil {
return x.Status
}
return CopyStatus_DRAFT
}
func (x *RestoreTape) GetFiles() []*RestoreFile {
if x != nil {
return x.Files
}
return nil
}
type JobDisplayRestore struct {
type JobRestoreState struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
CopyedBytes int64 `protobuf:"varint,1,opt,name=copyedBytes,proto3" json:"copyedBytes,omitempty"`
CopyedFiles int64 `protobuf:"varint,2,opt,name=copyedFiles,proto3" json:"copyedFiles,omitempty"`
TotalBytes int64 `protobuf:"varint,3,opt,name=totalBytes,proto3" json:"totalBytes,omitempty"`
TotalFiles int64 `protobuf:"varint,4,opt,name=totalFiles,proto3" json:"totalFiles,omitempty"`
Logs []byte `protobuf:"bytes,17,opt,name=logs,proto3" json:"logs,omitempty"`
Step JobRestoreStep `protobuf:"varint,1,opt,name=step,proto3,enum=job_restore.JobRestoreStep" json:"step,omitempty"`
Tapes []*RestoreTape `protobuf:"bytes,2,rep,name=tapes,proto3" json:"tapes,omitempty"`
}
func (x *JobDisplayRestore) Reset() {
*x = JobDisplayRestore{}
func (x *JobRestoreState) Reset() {
*x = JobRestoreState{}
if protoimpl.UnsafeEnabled {
mi := &file_job_restore_proto_msgTypes[7]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
@@ -491,13 +520,13 @@ func (x *JobDisplayRestore) Reset() {
}
}
func (x *JobDisplayRestore) String() string {
func (x *JobRestoreState) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*JobDisplayRestore) ProtoMessage() {}
func (*JobRestoreState) ProtoMessage() {}
func (x *JobDisplayRestore) ProtoReflect() protoreflect.Message {
func (x *JobRestoreState) ProtoReflect() protoreflect.Message {
mi := &file_job_restore_proto_msgTypes[7]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
@@ -509,40 +538,114 @@ func (x *JobDisplayRestore) ProtoReflect() protoreflect.Message {
return mi.MessageOf(x)
}
// Deprecated: Use JobDisplayRestore.ProtoReflect.Descriptor instead.
func (*JobDisplayRestore) Descriptor() ([]byte, []int) {
// Deprecated: Use JobRestoreState.ProtoReflect.Descriptor instead.
func (*JobRestoreState) Descriptor() ([]byte, []int) {
return file_job_restore_proto_rawDescGZIP(), []int{7}
}
func (x *JobDisplayRestore) GetCopyedBytes() int64 {
func (x *JobRestoreState) GetStep() JobRestoreStep {
if x != nil {
return x.Step
}
return JobRestoreStep_PENDING
}
func (x *JobRestoreState) GetTapes() []*RestoreTape {
if x != nil {
return x.Tapes
}
return nil
}
type JobRestoreDisplay struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
CopyedBytes int64 `protobuf:"varint,1,opt,name=copyed_bytes,json=copyedBytes,proto3" json:"copyed_bytes,omitempty"`
CopyedFiles int64 `protobuf:"varint,2,opt,name=copyed_files,json=copyedFiles,proto3" json:"copyed_files,omitempty"`
TotalBytes int64 `protobuf:"varint,3,opt,name=total_bytes,json=totalBytes,proto3" json:"total_bytes,omitempty"`
TotalFiles int64 `protobuf:"varint,4,opt,name=total_files,json=totalFiles,proto3" json:"total_files,omitempty"`
Speed *int64 `protobuf:"varint,5,opt,name=speed,proto3,oneof" json:"speed,omitempty"`
StartTime int64 `protobuf:"varint,6,opt,name=start_time,json=startTime,proto3" json:"start_time,omitempty"`
Logs []byte `protobuf:"bytes,17,opt,name=logs,proto3" json:"logs,omitempty"`
}
func (x *JobRestoreDisplay) Reset() {
*x = JobRestoreDisplay{}
if protoimpl.UnsafeEnabled {
mi := &file_job_restore_proto_msgTypes[8]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *JobRestoreDisplay) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*JobRestoreDisplay) ProtoMessage() {}
func (x *JobRestoreDisplay) ProtoReflect() protoreflect.Message {
mi := &file_job_restore_proto_msgTypes[8]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use JobRestoreDisplay.ProtoReflect.Descriptor instead.
func (*JobRestoreDisplay) Descriptor() ([]byte, []int) {
return file_job_restore_proto_rawDescGZIP(), []int{8}
}
func (x *JobRestoreDisplay) GetCopyedBytes() int64 {
if x != nil {
return x.CopyedBytes
}
return 0
}
func (x *JobDisplayRestore) GetCopyedFiles() int64 {
func (x *JobRestoreDisplay) GetCopyedFiles() int64 {
if x != nil {
return x.CopyedFiles
}
return 0
}
func (x *JobDisplayRestore) GetTotalBytes() int64 {
func (x *JobRestoreDisplay) GetTotalBytes() int64 {
if x != nil {
return x.TotalBytes
}
return 0
}
func (x *JobDisplayRestore) GetTotalFiles() int64 {
func (x *JobRestoreDisplay) GetTotalFiles() int64 {
if x != nil {
return x.TotalFiles
}
return 0
}
func (x *JobDisplayRestore) GetLogs() []byte {
func (x *JobRestoreDisplay) GetSpeed() int64 {
if x != nil && x.Speed != nil {
return *x.Speed
}
return 0
}
func (x *JobRestoreDisplay) GetStartTime() int64 {
if x != nil {
return x.StartTime
}
return 0
}
func (x *JobRestoreDisplay) GetLogs() []byte {
if x != nil {
return x.Logs
}
@@ -555,69 +658,87 @@ var file_job_restore_proto_rawDesc = []byte{
0x0a, 0x11, 0x6a, 0x6f, 0x62, 0x5f, 0x72, 0x65, 0x73, 0x74, 0x6f, 0x72, 0x65, 0x2e, 0x70, 0x72,
0x6f, 0x74, 0x6f, 0x12, 0x0b, 0x6a, 0x6f, 0x62, 0x5f, 0x72, 0x65, 0x73, 0x74, 0x6f, 0x72, 0x65,
0x1a, 0x11, 0x63, 0x6f, 0x70, 0x79, 0x5f, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x2e, 0x70, 0x72,
0x6f, 0x74, 0x6f, 0x22, 0x2c, 0x0a, 0x0f, 0x4a, 0x6f, 0x62, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x52,
0x65, 0x73, 0x74, 0x6f, 0x72, 0x65, 0x12, 0x19, 0x0a, 0x08, 0x66, 0x69, 0x6c, 0x65, 0x5f, 0x69,
0x6f, 0x74, 0x6f, 0x22, 0x2c, 0x0a, 0x0f, 0x4a, 0x6f, 0x62, 0x52, 0x65, 0x73, 0x74, 0x6f, 0x72,
0x65, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x12, 0x19, 0x0a, 0x08, 0x66, 0x69, 0x6c, 0x65, 0x5f, 0x69,
0x64, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x03, 0x52, 0x07, 0x66, 0x69, 0x6c, 0x65, 0x49, 0x64,
0x73, 0x22, 0xf1, 0x01, 0x0a, 0x13, 0x4a, 0x6f, 0x62, 0x52, 0x65, 0x73, 0x74, 0x6f, 0x72, 0x65,
0x4e, 0x65, 0x78, 0x74, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x12, 0x4b, 0x0a, 0x0b, 0x57, 0x61, 0x69,
0x74, 0x46, 0x6f, 0x72, 0x54, 0x61, 0x70, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x27,
0x2e, 0x6a, 0x6f, 0x62, 0x5f, 0x72, 0x65, 0x73, 0x74, 0x6f, 0x72, 0x65, 0x2e, 0x4a, 0x6f, 0x62,
0x52, 0x65, 0x73, 0x74, 0x6f, 0x72, 0x65, 0x57, 0x61, 0x69, 0x74, 0x46, 0x6f, 0x72, 0x54, 0x61,
0x70, 0x65, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x48, 0x00, 0x52, 0x0b, 0x57, 0x61, 0x69, 0x74, 0x46,
0x6f, 0x72, 0x54, 0x61, 0x70, 0x65, 0x12, 0x3f, 0x0a, 0x07, 0x43, 0x6f, 0x70, 0x79, 0x69, 0x6e,
0x67, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x23, 0x2e, 0x6a, 0x6f, 0x62, 0x5f, 0x72, 0x65,
0x73, 0x74, 0x6f, 0x72, 0x65, 0x2e, 0x4a, 0x6f, 0x62, 0x52, 0x65, 0x73, 0x74, 0x6f, 0x72, 0x65,
0x43, 0x6f, 0x70, 0x79, 0x69, 0x6e, 0x67, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x48, 0x00, 0x52, 0x07,
0x43, 0x6f, 0x70, 0x79, 0x69, 0x6e, 0x67, 0x12, 0x43, 0x0a, 0x08, 0x46, 0x69, 0x6e, 0x69, 0x73,
0x68, 0x65, 0x64, 0x18, 0xff, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x24, 0x2e, 0x6a, 0x6f, 0x62,
0x5f, 0x72, 0x65, 0x73, 0x74, 0x6f, 0x72, 0x65, 0x2e, 0x4a, 0x6f, 0x62, 0x52, 0x65, 0x73, 0x74,
0x6f, 0x72, 0x65, 0x46, 0x69, 0x6e, 0x69, 0x73, 0x68, 0x65, 0x64, 0x50, 0x61, 0x72, 0x61, 0x6d,
0x48, 0x00, 0x52, 0x08, 0x46, 0x69, 0x6e, 0x69, 0x73, 0x68, 0x65, 0x64, 0x42, 0x07, 0x0a, 0x05,
0x70, 0x61, 0x72, 0x61, 0x6d, 0x22, 0x1c, 0x0a, 0x1a, 0x4a, 0x6f, 0x62, 0x52, 0x65, 0x73, 0x74,
0x6f, 0x72, 0x65, 0x57, 0x61, 0x69, 0x74, 0x46, 0x6f, 0x72, 0x54, 0x61, 0x70, 0x65, 0x50, 0x61,
0x72, 0x61, 0x6d, 0x22, 0x30, 0x0a, 0x16, 0x4a, 0x6f, 0x62, 0x52, 0x65, 0x73, 0x74, 0x6f, 0x72,
0x65, 0x43, 0x6f, 0x70, 0x79, 0x69, 0x6e, 0x67, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x12, 0x16, 0x0a,
0x06, 0x64, 0x65, 0x76, 0x69, 0x63, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x64,
0x65, 0x76, 0x69, 0x63, 0x65, 0x22, 0x19, 0x0a, 0x17, 0x4a, 0x6f, 0x62, 0x52, 0x65, 0x73, 0x74,
0x6f, 0x72, 0x65, 0x46, 0x69, 0x6e, 0x69, 0x73, 0x68, 0x65, 0x64, 0x50, 0x61, 0x72, 0x61, 0x6d,
0x22, 0xb8, 0x01, 0x0a, 0x10, 0x46, 0x69, 0x6c, 0x65, 0x52, 0x65, 0x73, 0x74, 0x6f, 0x72, 0x65,
0x53, 0x74, 0x61, 0x74, 0x65, 0x12, 0x17, 0x0a, 0x07, 0x66, 0x69, 0x6c, 0x65, 0x5f, 0x69, 0x64,
0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x06, 0x66, 0x69, 0x6c, 0x65, 0x49, 0x64, 0x12, 0x2f,
0x0a, 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x17,
0x2e, 0x63, 0x6f, 0x70, 0x79, 0x5f, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x2e, 0x43, 0x6f, 0x70,
0x79, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x52, 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x12,
0x17, 0x0a, 0x07, 0x74, 0x61, 0x70, 0x65, 0x5f, 0x69, 0x64, 0x18, 0x11, 0x20, 0x01, 0x28, 0x03,
0x52, 0x06, 0x74, 0x61, 0x70, 0x65, 0x49, 0x64, 0x12, 0x1f, 0x0a, 0x0b, 0x70, 0x6f, 0x73, 0x69,
0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x69, 0x64, 0x18, 0x12, 0x20, 0x01, 0x28, 0x03, 0x52, 0x0a, 0x70,
0x6f, 0x73, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x49, 0x64, 0x12, 0x20, 0x0a, 0x0c, 0x70, 0x61, 0x74,
0x68, 0x5f, 0x69, 0x6e, 0x5f, 0x74, 0x61, 0x70, 0x65, 0x18, 0x13, 0x20, 0x03, 0x28, 0x09, 0x52,
0x0a, 0x70, 0x61, 0x74, 0x68, 0x49, 0x6e, 0x54, 0x61, 0x70, 0x65, 0x22, 0x77, 0x0a, 0x0f, 0x4a,
0x6f, 0x62, 0x53, 0x74, 0x61, 0x74, 0x65, 0x52, 0x65, 0x73, 0x74, 0x6f, 0x72, 0x65, 0x12, 0x2f,
0x0a, 0x04, 0x73, 0x74, 0x65, 0x70, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x1b, 0x2e, 0x6a,
0x73, 0x22, 0xf3, 0x01, 0x0a, 0x13, 0x4a, 0x6f, 0x62, 0x52, 0x65, 0x73, 0x74, 0x6f, 0x72, 0x65,
0x4e, 0x65, 0x78, 0x74, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x12, 0x4d, 0x0a, 0x0d, 0x77, 0x61, 0x69,
0x74, 0x5f, 0x66, 0x6f, 0x72, 0x5f, 0x74, 0x61, 0x70, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b,
0x32, 0x27, 0x2e, 0x6a, 0x6f, 0x62, 0x5f, 0x72, 0x65, 0x73, 0x74, 0x6f, 0x72, 0x65, 0x2e, 0x4a,
0x6f, 0x62, 0x52, 0x65, 0x73, 0x74, 0x6f, 0x72, 0x65, 0x57, 0x61, 0x69, 0x74, 0x46, 0x6f, 0x72,
0x54, 0x61, 0x70, 0x65, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x48, 0x00, 0x52, 0x0b, 0x77, 0x61, 0x69,
0x74, 0x46, 0x6f, 0x72, 0x54, 0x61, 0x70, 0x65, 0x12, 0x3f, 0x0a, 0x07, 0x63, 0x6f, 0x70, 0x79,
0x69, 0x6e, 0x67, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x23, 0x2e, 0x6a, 0x6f, 0x62, 0x5f,
0x72, 0x65, 0x73, 0x74, 0x6f, 0x72, 0x65, 0x2e, 0x4a, 0x6f, 0x62, 0x52, 0x65, 0x73, 0x74, 0x6f,
0x72, 0x65, 0x43, 0x6f, 0x70, 0x79, 0x69, 0x6e, 0x67, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x48, 0x00,
0x52, 0x07, 0x63, 0x6f, 0x70, 0x79, 0x69, 0x6e, 0x67, 0x12, 0x43, 0x0a, 0x08, 0x66, 0x69, 0x6e,
0x69, 0x73, 0x68, 0x65, 0x64, 0x18, 0xff, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x24, 0x2e, 0x6a,
0x6f, 0x62, 0x5f, 0x72, 0x65, 0x73, 0x74, 0x6f, 0x72, 0x65, 0x2e, 0x4a, 0x6f, 0x62, 0x52, 0x65,
0x73, 0x74, 0x6f, 0x72, 0x65, 0x53, 0x74, 0x65, 0x70, 0x52, 0x04, 0x73, 0x74, 0x65, 0x70, 0x12,
0x33, 0x0a, 0x05, 0x66, 0x69, 0x6c, 0x65, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1d,
0x2e, 0x6a, 0x6f, 0x62, 0x5f, 0x72, 0x65, 0x73, 0x74, 0x6f, 0x72, 0x65, 0x2e, 0x46, 0x69, 0x6c,
0x65, 0x52, 0x65, 0x73, 0x74, 0x6f, 0x72, 0x65, 0x53, 0x74, 0x61, 0x74, 0x65, 0x52, 0x05, 0x66,
0x69, 0x6c, 0x65, 0x73, 0x22, 0xab, 0x01, 0x0a, 0x11, 0x4a, 0x6f, 0x62, 0x44, 0x69, 0x73, 0x70,
0x6c, 0x61, 0x79, 0x52, 0x65, 0x73, 0x74, 0x6f, 0x72, 0x65, 0x12, 0x20, 0x0a, 0x0b, 0x63, 0x6f,
0x70, 0x79, 0x65, 0x64, 0x42, 0x79, 0x74, 0x65, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52,
0x0b, 0x63, 0x6f, 0x70, 0x79, 0x65, 0x64, 0x42, 0x79, 0x74, 0x65, 0x73, 0x12, 0x20, 0x0a, 0x0b,
0x63, 0x6f, 0x70, 0x79, 0x65, 0x64, 0x46, 0x69, 0x6c, 0x65, 0x73, 0x18, 0x02, 0x20, 0x01, 0x28,
0x03, 0x52, 0x0b, 0x63, 0x6f, 0x70, 0x79, 0x65, 0x64, 0x46, 0x69, 0x6c, 0x65, 0x73, 0x12, 0x1e,
0x0a, 0x0a, 0x74, 0x6f, 0x74, 0x61, 0x6c, 0x42, 0x79, 0x74, 0x65, 0x73, 0x18, 0x03, 0x20, 0x01,
0x28, 0x03, 0x52, 0x0a, 0x74, 0x6f, 0x74, 0x61, 0x6c, 0x42, 0x79, 0x74, 0x65, 0x73, 0x12, 0x1e,
0x0a, 0x0a, 0x74, 0x6f, 0x74, 0x61, 0x6c, 0x46, 0x69, 0x6c, 0x65, 0x73, 0x18, 0x04, 0x20, 0x01,
0x28, 0x03, 0x52, 0x0a, 0x74, 0x6f, 0x74, 0x61, 0x6c, 0x46, 0x69, 0x6c, 0x65, 0x73, 0x12, 0x12,
0x0a, 0x04, 0x6c, 0x6f, 0x67, 0x73, 0x18, 0x11, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x04, 0x6c, 0x6f,
0x67, 0x73, 0x2a, 0x4a, 0x0a, 0x0e, 0x4a, 0x6f, 0x62, 0x52, 0x65, 0x73, 0x74, 0x6f, 0x72, 0x65,
0x53, 0x74, 0x65, 0x70, 0x12, 0x0b, 0x0a, 0x07, 0x50, 0x65, 0x6e, 0x64, 0x69, 0x6e, 0x67, 0x10,
0x00, 0x12, 0x0f, 0x0a, 0x0b, 0x57, 0x61, 0x69, 0x74, 0x46, 0x6f, 0x72, 0x54, 0x61, 0x70, 0x65,
0x10, 0x01, 0x12, 0x0b, 0x0a, 0x07, 0x43, 0x6f, 0x70, 0x79, 0x69, 0x6e, 0x67, 0x10, 0x02, 0x12,
0x0d, 0x0a, 0x08, 0x46, 0x69, 0x6e, 0x69, 0x73, 0x68, 0x65, 0x64, 0x10, 0xff, 0x01, 0x42, 0x28,
0x5a, 0x26, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x61, 0x62, 0x63,
0x39, 0x35, 0x30, 0x33, 0x30, 0x39, 0x2f, 0x74, 0x61, 0x70, 0x65, 0x77, 0x72, 0x69, 0x74, 0x65,
0x72, 0x2f, 0x65, 0x6e, 0x74, 0x69, 0x74, 0x79, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
0x73, 0x74, 0x6f, 0x72, 0x65, 0x46, 0x69, 0x6e, 0x69, 0x73, 0x68, 0x65, 0x64, 0x50, 0x61, 0x72,
0x61, 0x6d, 0x48, 0x00, 0x52, 0x08, 0x66, 0x69, 0x6e, 0x69, 0x73, 0x68, 0x65, 0x64, 0x42, 0x07,
0x0a, 0x05, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x22, 0x1c, 0x0a, 0x1a, 0x4a, 0x6f, 0x62, 0x52, 0x65,
0x73, 0x74, 0x6f, 0x72, 0x65, 0x57, 0x61, 0x69, 0x74, 0x46, 0x6f, 0x72, 0x54, 0x61, 0x70, 0x65,
0x50, 0x61, 0x72, 0x61, 0x6d, 0x22, 0x30, 0x0a, 0x16, 0x4a, 0x6f, 0x62, 0x52, 0x65, 0x73, 0x74,
0x6f, 0x72, 0x65, 0x43, 0x6f, 0x70, 0x79, 0x69, 0x6e, 0x67, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x12,
0x16, 0x0a, 0x06, 0x64, 0x65, 0x76, 0x69, 0x63, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52,
0x06, 0x64, 0x65, 0x76, 0x69, 0x63, 0x65, 0x22, 0x19, 0x0a, 0x17, 0x4a, 0x6f, 0x62, 0x52, 0x65,
0x73, 0x74, 0x6f, 0x72, 0x65, 0x46, 0x69, 0x6e, 0x69, 0x73, 0x68, 0x65, 0x64, 0x50, 0x61, 0x72,
0x61, 0x6d, 0x22, 0xe3, 0x01, 0x0a, 0x0b, 0x52, 0x65, 0x73, 0x74, 0x6f, 0x72, 0x65, 0x46, 0x69,
0x6c, 0x65, 0x12, 0x17, 0x0a, 0x07, 0x66, 0x69, 0x6c, 0x65, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20,
0x01, 0x28, 0x03, 0x52, 0x06, 0x66, 0x69, 0x6c, 0x65, 0x49, 0x64, 0x12, 0x17, 0x0a, 0x07, 0x74,
0x61, 0x70, 0x65, 0x5f, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x03, 0x52, 0x06, 0x74, 0x61,
0x70, 0x65, 0x49, 0x64, 0x12, 0x1f, 0x0a, 0x0b, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x69, 0x6f, 0x6e,
0x5f, 0x69, 0x64, 0x18, 0x03, 0x20, 0x01, 0x28, 0x03, 0x52, 0x0a, 0x70, 0x6f, 0x73, 0x69, 0x74,
0x69, 0x6f, 0x6e, 0x49, 0x64, 0x12, 0x2f, 0x0a, 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x18,
0x11, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x17, 0x2e, 0x63, 0x6f, 0x70, 0x79, 0x5f, 0x73, 0x74, 0x61,
0x74, 0x75, 0x73, 0x2e, 0x43, 0x6f, 0x70, 0x79, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x52, 0x06,
0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x12, 0x0a, 0x04, 0x73, 0x69, 0x7a, 0x65, 0x18, 0x12,
0x20, 0x01, 0x28, 0x03, 0x52, 0x04, 0x73, 0x69, 0x7a, 0x65, 0x12, 0x1b, 0x0a, 0x09, 0x74, 0x61,
0x70, 0x65, 0x5f, 0x70, 0x61, 0x74, 0x68, 0x18, 0x21, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x74,
0x61, 0x70, 0x65, 0x50, 0x61, 0x74, 0x68, 0x12, 0x1f, 0x0a, 0x0b, 0x74, 0x61, 0x72, 0x67, 0x65,
0x74, 0x5f, 0x70, 0x61, 0x74, 0x68, 0x18, 0x22, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x74, 0x61,
0x72, 0x67, 0x65, 0x74, 0x50, 0x61, 0x74, 0x68, 0x22, 0xa1, 0x01, 0x0a, 0x0b, 0x52, 0x65, 0x73,
0x74, 0x6f, 0x72, 0x65, 0x54, 0x61, 0x70, 0x65, 0x12, 0x17, 0x0a, 0x07, 0x74, 0x61, 0x70, 0x65,
0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x06, 0x74, 0x61, 0x70, 0x65, 0x49,
0x64, 0x12, 0x18, 0x0a, 0x07, 0x62, 0x61, 0x72, 0x63, 0x6f, 0x64, 0x65, 0x18, 0x02, 0x20, 0x01,
0x28, 0x09, 0x52, 0x07, 0x62, 0x61, 0x72, 0x63, 0x6f, 0x64, 0x65, 0x12, 0x2f, 0x0a, 0x06, 0x73,
0x74, 0x61, 0x74, 0x75, 0x73, 0x18, 0x11, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x17, 0x2e, 0x63, 0x6f,
0x70, 0x79, 0x5f, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x2e, 0x43, 0x6f, 0x70, 0x79, 0x53, 0x74,
0x61, 0x74, 0x75, 0x73, 0x52, 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x2e, 0x0a, 0x05,
0x66, 0x69, 0x6c, 0x65, 0x73, 0x18, 0x12, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x18, 0x2e, 0x6a, 0x6f,
0x62, 0x5f, 0x72, 0x65, 0x73, 0x74, 0x6f, 0x72, 0x65, 0x2e, 0x52, 0x65, 0x73, 0x74, 0x6f, 0x72,
0x65, 0x46, 0x69, 0x6c, 0x65, 0x52, 0x05, 0x66, 0x69, 0x6c, 0x65, 0x73, 0x22, 0x72, 0x0a, 0x0f,
0x4a, 0x6f, 0x62, 0x52, 0x65, 0x73, 0x74, 0x6f, 0x72, 0x65, 0x53, 0x74, 0x61, 0x74, 0x65, 0x12,
0x2f, 0x0a, 0x04, 0x73, 0x74, 0x65, 0x70, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x1b, 0x2e,
0x6a, 0x6f, 0x62, 0x5f, 0x72, 0x65, 0x73, 0x74, 0x6f, 0x72, 0x65, 0x2e, 0x4a, 0x6f, 0x62, 0x52,
0x65, 0x73, 0x74, 0x6f, 0x72, 0x65, 0x53, 0x74, 0x65, 0x70, 0x52, 0x04, 0x73, 0x74, 0x65, 0x70,
0x12, 0x2e, 0x0a, 0x05, 0x74, 0x61, 0x70, 0x65, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32,
0x18, 0x2e, 0x6a, 0x6f, 0x62, 0x5f, 0x72, 0x65, 0x73, 0x74, 0x6f, 0x72, 0x65, 0x2e, 0x52, 0x65,
0x73, 0x74, 0x6f, 0x72, 0x65, 0x54, 0x61, 0x70, 0x65, 0x52, 0x05, 0x74, 0x61, 0x70, 0x65, 0x73,
0x22, 0xf3, 0x01, 0x0a, 0x11, 0x4a, 0x6f, 0x62, 0x52, 0x65, 0x73, 0x74, 0x6f, 0x72, 0x65, 0x44,
0x69, 0x73, 0x70, 0x6c, 0x61, 0x79, 0x12, 0x21, 0x0a, 0x0c, 0x63, 0x6f, 0x70, 0x79, 0x65, 0x64,
0x5f, 0x62, 0x79, 0x74, 0x65, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x0b, 0x63, 0x6f,
0x70, 0x79, 0x65, 0x64, 0x42, 0x79, 0x74, 0x65, 0x73, 0x12, 0x21, 0x0a, 0x0c, 0x63, 0x6f, 0x70,
0x79, 0x65, 0x64, 0x5f, 0x66, 0x69, 0x6c, 0x65, 0x73, 0x18, 0x02, 0x20, 0x01, 0x28, 0x03, 0x52,
0x0b, 0x63, 0x6f, 0x70, 0x79, 0x65, 0x64, 0x46, 0x69, 0x6c, 0x65, 0x73, 0x12, 0x1f, 0x0a, 0x0b,
0x74, 0x6f, 0x74, 0x61, 0x6c, 0x5f, 0x62, 0x79, 0x74, 0x65, 0x73, 0x18, 0x03, 0x20, 0x01, 0x28,
0x03, 0x52, 0x0a, 0x74, 0x6f, 0x74, 0x61, 0x6c, 0x42, 0x79, 0x74, 0x65, 0x73, 0x12, 0x1f, 0x0a,
0x0b, 0x74, 0x6f, 0x74, 0x61, 0x6c, 0x5f, 0x66, 0x69, 0x6c, 0x65, 0x73, 0x18, 0x04, 0x20, 0x01,
0x28, 0x03, 0x52, 0x0a, 0x74, 0x6f, 0x74, 0x61, 0x6c, 0x46, 0x69, 0x6c, 0x65, 0x73, 0x12, 0x19,
0x0a, 0x05, 0x73, 0x70, 0x65, 0x65, 0x64, 0x18, 0x05, 0x20, 0x01, 0x28, 0x03, 0x48, 0x00, 0x52,
0x05, 0x73, 0x70, 0x65, 0x65, 0x64, 0x88, 0x01, 0x01, 0x12, 0x1d, 0x0a, 0x0a, 0x73, 0x74, 0x61,
0x72, 0x74, 0x5f, 0x74, 0x69, 0x6d, 0x65, 0x18, 0x06, 0x20, 0x01, 0x28, 0x03, 0x52, 0x09, 0x73,
0x74, 0x61, 0x72, 0x74, 0x54, 0x69, 0x6d, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x6c, 0x6f, 0x67, 0x73,
0x18, 0x11, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x04, 0x6c, 0x6f, 0x67, 0x73, 0x42, 0x08, 0x0a, 0x06,
0x5f, 0x73, 0x70, 0x65, 0x65, 0x64, 0x2a, 0x4c, 0x0a, 0x0e, 0x4a, 0x6f, 0x62, 0x52, 0x65, 0x73,
0x74, 0x6f, 0x72, 0x65, 0x53, 0x74, 0x65, 0x70, 0x12, 0x0b, 0x0a, 0x07, 0x50, 0x45, 0x4e, 0x44,
0x49, 0x4e, 0x47, 0x10, 0x00, 0x12, 0x11, 0x0a, 0x0d, 0x57, 0x41, 0x49, 0x54, 0x5f, 0x46, 0x4f,
0x52, 0x5f, 0x54, 0x41, 0x50, 0x45, 0x10, 0x01, 0x12, 0x0b, 0x0a, 0x07, 0x43, 0x4f, 0x50, 0x59,
0x49, 0x4e, 0x47, 0x10, 0x02, 0x12, 0x0d, 0x0a, 0x08, 0x46, 0x49, 0x4e, 0x49, 0x53, 0x48, 0x45,
0x44, 0x10, 0xff, 0x01, 0x42, 0x28, 0x5a, 0x26, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63,
0x6f, 0x6d, 0x2f, 0x61, 0x62, 0x63, 0x39, 0x35, 0x30, 0x33, 0x30, 0x39, 0x2f, 0x74, 0x61, 0x70,
0x65, 0x77, 0x72, 0x69, 0x74, 0x65, 0x72, 0x2f, 0x65, 0x6e, 0x74, 0x69, 0x74, 0x79, 0x62, 0x06,
0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
}
var (
@@ -633,31 +754,34 @@ func file_job_restore_proto_rawDescGZIP() []byte {
}
var file_job_restore_proto_enumTypes = make([]protoimpl.EnumInfo, 1)
var file_job_restore_proto_msgTypes = make([]protoimpl.MessageInfo, 8)
var file_job_restore_proto_msgTypes = make([]protoimpl.MessageInfo, 9)
var file_job_restore_proto_goTypes = []interface{}{
(JobRestoreStep)(0), // 0: job_restore.JobRestoreStep
(*JobParamRestore)(nil), // 1: job_restore.JobParamRestore
(*JobRestoreParam)(nil), // 1: job_restore.JobRestoreParam
(*JobRestoreNextParam)(nil), // 2: job_restore.JobRestoreNextParam
(*JobRestoreWaitForTapeParam)(nil), // 3: job_restore.JobRestoreWaitForTapeParam
(*JobRestoreCopyingParam)(nil), // 4: job_restore.JobRestoreCopyingParam
(*JobRestoreFinishedParam)(nil), // 5: job_restore.JobRestoreFinishedParam
(*FileRestoreState)(nil), // 6: job_restore.FileRestoreState
(*JobStateRestore)(nil), // 7: job_restore.JobStateRestore
(*JobDisplayRestore)(nil), // 8: job_restore.JobDisplayRestore
(CopyStatus)(0), // 9: copy_status.CopyStatus
(*RestoreFile)(nil), // 6: job_restore.RestoreFile
(*RestoreTape)(nil), // 7: job_restore.RestoreTape
(*JobRestoreState)(nil), // 8: job_restore.JobRestoreState
(*JobRestoreDisplay)(nil), // 9: job_restore.JobRestoreDisplay
(CopyStatus)(0), // 10: copy_status.CopyStatus
}
var file_job_restore_proto_depIdxs = []int32{
3, // 0: job_restore.JobRestoreNextParam.WaitForTape:type_name -> job_restore.JobRestoreWaitForTapeParam
4, // 1: job_restore.JobRestoreNextParam.Copying:type_name -> job_restore.JobRestoreCopyingParam
5, // 2: job_restore.JobRestoreNextParam.Finished:type_name -> job_restore.JobRestoreFinishedParam
9, // 3: job_restore.FileRestoreState.status:type_name -> copy_status.CopyStatus
0, // 4: job_restore.JobStateRestore.step:type_name -> job_restore.JobRestoreStep
6, // 5: job_restore.JobStateRestore.files:type_name -> job_restore.FileRestoreState
6, // [6:6] is the sub-list for method output_type
6, // [6:6] is the sub-list for method input_type
6, // [6:6] is the sub-list for extension type_name
6, // [6:6] is the sub-list for extension extendee
0, // [0:6] is the sub-list for field type_name
3, // 0: job_restore.JobRestoreNextParam.wait_for_tape:type_name -> job_restore.JobRestoreWaitForTapeParam
4, // 1: job_restore.JobRestoreNextParam.copying:type_name -> job_restore.JobRestoreCopyingParam
5, // 2: job_restore.JobRestoreNextParam.finished:type_name -> job_restore.JobRestoreFinishedParam
10, // 3: job_restore.RestoreFile.status:type_name -> copy_status.CopyStatus
10, // 4: job_restore.RestoreTape.status:type_name -> copy_status.CopyStatus
6, // 5: job_restore.RestoreTape.files:type_name -> job_restore.RestoreFile
0, // 6: job_restore.JobRestoreState.step:type_name -> job_restore.JobRestoreStep
7, // 7: job_restore.JobRestoreState.tapes:type_name -> job_restore.RestoreTape
8, // [8:8] is the sub-list for method output_type
8, // [8:8] is the sub-list for method input_type
8, // [8:8] is the sub-list for extension type_name
8, // [8:8] is the sub-list for extension extendee
0, // [0:8] is the sub-list for field type_name
}
func init() { file_job_restore_proto_init() }
@@ -668,7 +792,7 @@ func file_job_restore_proto_init() {
file_copy_status_proto_init()
if !protoimpl.UnsafeEnabled {
file_job_restore_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*JobParamRestore); i {
switch v := v.(*JobRestoreParam); i {
case 0:
return &v.state
case 1:
@@ -728,7 +852,7 @@ func file_job_restore_proto_init() {
}
}
file_job_restore_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*FileRestoreState); i {
switch v := v.(*RestoreFile); i {
case 0:
return &v.state
case 1:
@@ -740,7 +864,7 @@ func file_job_restore_proto_init() {
}
}
file_job_restore_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*JobStateRestore); i {
switch v := v.(*RestoreTape); i {
case 0:
return &v.state
case 1:
@@ -752,7 +876,19 @@ func file_job_restore_proto_init() {
}
}
file_job_restore_proto_msgTypes[7].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*JobDisplayRestore); i {
switch v := v.(*JobRestoreState); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_job_restore_proto_msgTypes[8].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*JobRestoreDisplay); i {
case 0:
return &v.state
case 1:
@@ -769,13 +905,14 @@ func file_job_restore_proto_init() {
(*JobRestoreNextParam_Copying)(nil),
(*JobRestoreNextParam_Finished)(nil),
}
file_job_restore_proto_msgTypes[8].OneofWrappers = []interface{}{}
type x struct{}
out := protoimpl.TypeBuilder{
File: protoimpl.DescBuilder{
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
RawDescriptor: file_job_restore_proto_rawDesc,
NumEnums: 1,
NumMessages: 8,
NumMessages: 9,
NumExtensions: 0,
NumServices: 0,
},
+34 -20
View File
@@ -5,22 +5,22 @@ option go_package = "github.com/abc950309/tapewriter/entity";
import "copy_status.proto";
enum JobRestoreStep {
Pending = 0;
WaitForTape = 1;
Copying = 2;
PENDING = 0;
WAIT_FOR_TAPE = 1;
COPYING = 2;
Finished = 255;
FINISHED = 255;
}
message JobParamRestore {
message JobRestoreParam {
repeated int64 file_ids = 1;
}
message JobRestoreNextParam {
oneof param {
JobRestoreWaitForTapeParam WaitForTape = 1;
JobRestoreCopyingParam Copying = 2;
JobRestoreFinishedParam Finished = 255;
JobRestoreWaitForTapeParam wait_for_tape = 1;
JobRestoreCopyingParam copying = 2;
JobRestoreFinishedParam finished = 255;
}
}
@@ -32,25 +32,39 @@ message JobRestoreCopyingParam {
message JobRestoreFinishedParam {}
message FileRestoreState {
message RestoreFile {
int64 file_id = 1;
copy_status.CopyStatus status = 2;
int64 tape_id = 2;
int64 position_id = 3;
int64 tape_id = 17;
int64 position_id = 18;
repeated string path_in_tape = 19;
copy_status.CopyStatus status = 17;
int64 size = 18;
string tape_path = 33;
string target_path = 34;
}
message JobStateRestore {
message RestoreTape {
int64 tape_id = 1;
string barcode = 2;
copy_status.CopyStatus status = 17;
repeated RestoreFile files = 18;
}
message JobRestoreState {
JobRestoreStep step = 1;
repeated FileRestoreState files = 2;
repeated RestoreTape tapes = 2;
}
message JobDisplayRestore {
int64 copyedBytes = 1;
int64 copyedFiles = 2;
int64 totalBytes = 3;
int64 totalFiles = 4;
message JobRestoreDisplay {
int64 copyed_bytes = 1;
int64 copyed_files = 2;
int64 total_bytes = 3;
int64 total_files = 4;
optional int64 speed = 5;
int64 start_time = 6;
bytes logs = 17;
}
+138
View File
@@ -0,0 +1,138 @@
// Code generated by protoc-gen-go. DO NOT EDIT.
// versions:
// protoc-gen-go v1.28.1
// protoc v3.21.10
// source: library_entity_type.proto
package entity
import (
protoreflect "google.golang.org/protobuf/reflect/protoreflect"
protoimpl "google.golang.org/protobuf/runtime/protoimpl"
reflect "reflect"
sync "sync"
)
const (
// Verify that this generated code is sufficiently up-to-date.
_ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion)
// Verify that runtime/protoimpl is sufficiently up-to-date.
_ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20)
)
type LibraryEntityType int32
const (
LibraryEntityType_NONE LibraryEntityType = 0
LibraryEntityType_FILE LibraryEntityType = 1
LibraryEntityType_TAPE LibraryEntityType = 2
LibraryEntityType_POSITION LibraryEntityType = 3
)
// Enum value maps for LibraryEntityType.
var (
LibraryEntityType_name = map[int32]string{
0: "NONE",
1: "FILE",
2: "TAPE",
3: "POSITION",
}
LibraryEntityType_value = map[string]int32{
"NONE": 0,
"FILE": 1,
"TAPE": 2,
"POSITION": 3,
}
)
func (x LibraryEntityType) Enum() *LibraryEntityType {
p := new(LibraryEntityType)
*p = x
return p
}
func (x LibraryEntityType) String() string {
return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x))
}
func (LibraryEntityType) Descriptor() protoreflect.EnumDescriptor {
return file_library_entity_type_proto_enumTypes[0].Descriptor()
}
func (LibraryEntityType) Type() protoreflect.EnumType {
return &file_library_entity_type_proto_enumTypes[0]
}
func (x LibraryEntityType) Number() protoreflect.EnumNumber {
return protoreflect.EnumNumber(x)
}
// Deprecated: Use LibraryEntityType.Descriptor instead.
func (LibraryEntityType) EnumDescriptor() ([]byte, []int) {
return file_library_entity_type_proto_rawDescGZIP(), []int{0}
}
var File_library_entity_type_proto protoreflect.FileDescriptor
var file_library_entity_type_proto_rawDesc = []byte{
0x0a, 0x19, 0x6c, 0x69, 0x62, 0x72, 0x61, 0x72, 0x79, 0x5f, 0x65, 0x6e, 0x74, 0x69, 0x74, 0x79,
0x5f, 0x74, 0x79, 0x70, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x13, 0x6c, 0x69, 0x62,
0x72, 0x61, 0x72, 0x79, 0x5f, 0x65, 0x6e, 0x74, 0x69, 0x74, 0x79, 0x5f, 0x74, 0x79, 0x70, 0x65,
0x2a, 0x3f, 0x0a, 0x11, 0x4c, 0x69, 0x62, 0x72, 0x61, 0x72, 0x79, 0x45, 0x6e, 0x74, 0x69, 0x74,
0x79, 0x54, 0x79, 0x70, 0x65, 0x12, 0x08, 0x0a, 0x04, 0x4e, 0x4f, 0x4e, 0x45, 0x10, 0x00, 0x12,
0x08, 0x0a, 0x04, 0x46, 0x49, 0x4c, 0x45, 0x10, 0x01, 0x12, 0x08, 0x0a, 0x04, 0x54, 0x41, 0x50,
0x45, 0x10, 0x02, 0x12, 0x0c, 0x0a, 0x08, 0x50, 0x4f, 0x53, 0x49, 0x54, 0x49, 0x4f, 0x4e, 0x10,
0x03, 0x42, 0x28, 0x5a, 0x26, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f,
0x61, 0x62, 0x63, 0x39, 0x35, 0x30, 0x33, 0x30, 0x39, 0x2f, 0x74, 0x61, 0x70, 0x65, 0x77, 0x72,
0x69, 0x74, 0x65, 0x72, 0x2f, 0x65, 0x6e, 0x74, 0x69, 0x74, 0x79, 0x62, 0x06, 0x70, 0x72, 0x6f,
0x74, 0x6f, 0x33,
}
var (
file_library_entity_type_proto_rawDescOnce sync.Once
file_library_entity_type_proto_rawDescData = file_library_entity_type_proto_rawDesc
)
func file_library_entity_type_proto_rawDescGZIP() []byte {
file_library_entity_type_proto_rawDescOnce.Do(func() {
file_library_entity_type_proto_rawDescData = protoimpl.X.CompressGZIP(file_library_entity_type_proto_rawDescData)
})
return file_library_entity_type_proto_rawDescData
}
var file_library_entity_type_proto_enumTypes = make([]protoimpl.EnumInfo, 1)
var file_library_entity_type_proto_goTypes = []interface{}{
(LibraryEntityType)(0), // 0: library_entity_type.LibraryEntityType
}
var file_library_entity_type_proto_depIdxs = []int32{
0, // [0:0] is the sub-list for method output_type
0, // [0:0] is the sub-list for method input_type
0, // [0:0] is the sub-list for extension type_name
0, // [0:0] is the sub-list for extension extendee
0, // [0:0] is the sub-list for field type_name
}
func init() { file_library_entity_type_proto_init() }
func file_library_entity_type_proto_init() {
if File_library_entity_type_proto != nil {
return
}
type x struct{}
out := protoimpl.TypeBuilder{
File: protoimpl.DescBuilder{
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
RawDescriptor: file_library_entity_type_proto_rawDesc,
NumEnums: 1,
NumMessages: 0,
NumExtensions: 0,
NumServices: 0,
},
GoTypes: file_library_entity_type_proto_goTypes,
DependencyIndexes: file_library_entity_type_proto_depIdxs,
EnumInfos: file_library_entity_type_proto_enumTypes,
}.Build()
File_library_entity_type_proto = out.File
file_library_entity_type_proto_rawDesc = nil
file_library_entity_type_proto_goTypes = nil
file_library_entity_type_proto_depIdxs = nil
}
+10
View File
@@ -0,0 +1,10 @@
syntax = "proto3";
package library_entity_type;
option go_package = "github.com/abc950309/tapewriter/entity";
enum LibraryEntityType {
NONE = 0;
FILE = 1;
TAPE = 2;
POSITION = 3;
}
+801 -313
View File
File diff suppressed because it is too large Load Diff
+36 -2
View File
@@ -7,6 +7,7 @@ import "file.proto";
import "position.proto";
import "tape.proto";
import "source.proto";
import "library_entity_type.proto";
service Service {
rpc FileGet(FileGetRequest) returns (FileGetReply) {}
@@ -15,10 +16,12 @@ service Service {
rpc FileDelete(FileDeleteRequest) returns (FileDeleteReply) {}
rpc FileListParents(FileListParentsRequest) returns (FileListParentsReply) {}
rpc TapeMGet(TapeMGetRequest) returns (TapeMGetReply) {}
rpc TapeList(TapeListRequest) returns (TapeListReply) {}
rpc TapeDelete(TapeDeleteRequest) returns (TapeDeleteReply) {}
rpc JobList(JobListRequest) returns (JobListReply) {}
rpc JobCreate(JobCreateRequest) returns (JobCreateReply) {}
rpc JobDelete(JobDeleteRequest) returns (JobDeleteReply) {}
rpc JobNext(JobNextRequest) returns (JobNextReply) {}
rpc JobDisplay(JobDisplayRequest) returns (JobDisplayReply) {}
rpc JobGetLog(JobGetLogRequest) returns (JobGetLogReply) {}
@@ -26,6 +29,8 @@ service Service {
rpc SourceList(SourceListRequest) returns (SourceListReply) {}
rpc DeviceList(DeviceListRequest) returns (DeviceListReply) {}
rpc LibraryExport(LibraryExportRequest) returns (LibraryExportReply) {}
}
message FileGetRequest {
@@ -71,14 +76,28 @@ message FileListParentsReply {
repeated file.File parents = 1;
}
message TapeListRequest {
oneof param {
TapeMGetRequest mget = 1;
tape.TapeFilter list = 2;
}
}
message TapeMGetRequest {
repeated int64 ids = 1;
}
message TapeMGetReply {
message TapeListReply {
repeated tape.Tape tapes = 1;
}
message TapeDeleteRequest {
repeated int64 ids = 1;
}
message TapeDeleteReply {
}
message JobListRequest {
oneof param {
JobMGetRequest mget = 1;
@@ -102,6 +121,13 @@ message JobCreateReply {
job.Job job = 1;
}
message JobDeleteRequest {
repeated int64 ids = 1;
}
message JobDeleteReply {
}
message JobNextRequest {
int64 id = 1;
job.JobNextParam param = 2;
@@ -143,3 +169,11 @@ message DeviceListRequest {}
message DeviceListReply {
repeated string devices = 1;
}
message LibraryExportRequest {
repeated library_entity_type.LibraryEntityType types = 1;
}
message LibraryExportReply {
bytes json = 1;
}
+3
View File
@@ -14,3 +14,6 @@ protoc --go_out=$GO_DST_DIR --go_opt=paths=source_relative \
# --js_out=import_style=es6,binary:$TS_DST_DIR \
# --grpc-web_out=import_style=typescript,mode=grpcwebtext:$TS_DST_DIR \
cd ../frontend;
pnpm run gen-proto;
+122 -14
View File
@@ -27,14 +27,17 @@ type ServiceClient interface {
FileMkdir(ctx context.Context, in *FileMkdirRequest, opts ...grpc.CallOption) (*FileMkdirReply, error)
FileDelete(ctx context.Context, in *FileDeleteRequest, opts ...grpc.CallOption) (*FileDeleteReply, error)
FileListParents(ctx context.Context, in *FileListParentsRequest, opts ...grpc.CallOption) (*FileListParentsReply, error)
TapeMGet(ctx context.Context, in *TapeMGetRequest, opts ...grpc.CallOption) (*TapeMGetReply, error)
TapeList(ctx context.Context, in *TapeListRequest, opts ...grpc.CallOption) (*TapeListReply, error)
TapeDelete(ctx context.Context, in *TapeDeleteRequest, opts ...grpc.CallOption) (*TapeDeleteReply, error)
JobList(ctx context.Context, in *JobListRequest, opts ...grpc.CallOption) (*JobListReply, error)
JobCreate(ctx context.Context, in *JobCreateRequest, opts ...grpc.CallOption) (*JobCreateReply, error)
JobDelete(ctx context.Context, in *JobDeleteRequest, opts ...grpc.CallOption) (*JobDeleteReply, error)
JobNext(ctx context.Context, in *JobNextRequest, opts ...grpc.CallOption) (*JobNextReply, error)
JobDisplay(ctx context.Context, in *JobDisplayRequest, opts ...grpc.CallOption) (*JobDisplayReply, error)
JobGetLog(ctx context.Context, in *JobGetLogRequest, opts ...grpc.CallOption) (*JobGetLogReply, error)
SourceList(ctx context.Context, in *SourceListRequest, opts ...grpc.CallOption) (*SourceListReply, error)
DeviceList(ctx context.Context, in *DeviceListRequest, opts ...grpc.CallOption) (*DeviceListReply, error)
LibraryExport(ctx context.Context, in *LibraryExportRequest, opts ...grpc.CallOption) (*LibraryExportReply, error)
}
type serviceClient struct {
@@ -90,9 +93,18 @@ func (c *serviceClient) FileListParents(ctx context.Context, in *FileListParents
return out, nil
}
func (c *serviceClient) TapeMGet(ctx context.Context, in *TapeMGetRequest, opts ...grpc.CallOption) (*TapeMGetReply, error) {
out := new(TapeMGetReply)
err := c.cc.Invoke(ctx, "/service.Service/TapeMGet", in, out, opts...)
func (c *serviceClient) TapeList(ctx context.Context, in *TapeListRequest, opts ...grpc.CallOption) (*TapeListReply, error) {
out := new(TapeListReply)
err := c.cc.Invoke(ctx, "/service.Service/TapeList", in, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *serviceClient) TapeDelete(ctx context.Context, in *TapeDeleteRequest, opts ...grpc.CallOption) (*TapeDeleteReply, error) {
out := new(TapeDeleteReply)
err := c.cc.Invoke(ctx, "/service.Service/TapeDelete", in, out, opts...)
if err != nil {
return nil, err
}
@@ -117,6 +129,15 @@ func (c *serviceClient) JobCreate(ctx context.Context, in *JobCreateRequest, opt
return out, nil
}
func (c *serviceClient) JobDelete(ctx context.Context, in *JobDeleteRequest, opts ...grpc.CallOption) (*JobDeleteReply, error) {
out := new(JobDeleteReply)
err := c.cc.Invoke(ctx, "/service.Service/JobDelete", in, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *serviceClient) JobNext(ctx context.Context, in *JobNextRequest, opts ...grpc.CallOption) (*JobNextReply, error) {
out := new(JobNextReply)
err := c.cc.Invoke(ctx, "/service.Service/JobNext", in, out, opts...)
@@ -162,6 +183,15 @@ func (c *serviceClient) DeviceList(ctx context.Context, in *DeviceListRequest, o
return out, nil
}
func (c *serviceClient) LibraryExport(ctx context.Context, in *LibraryExportRequest, opts ...grpc.CallOption) (*LibraryExportReply, error) {
out := new(LibraryExportReply)
err := c.cc.Invoke(ctx, "/service.Service/LibraryExport", in, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
// ServiceServer is the server API for Service service.
// All implementations must embed UnimplementedServiceServer
// for forward compatibility
@@ -171,14 +201,17 @@ type ServiceServer interface {
FileMkdir(context.Context, *FileMkdirRequest) (*FileMkdirReply, error)
FileDelete(context.Context, *FileDeleteRequest) (*FileDeleteReply, error)
FileListParents(context.Context, *FileListParentsRequest) (*FileListParentsReply, error)
TapeMGet(context.Context, *TapeMGetRequest) (*TapeMGetReply, error)
TapeList(context.Context, *TapeListRequest) (*TapeListReply, error)
TapeDelete(context.Context, *TapeDeleteRequest) (*TapeDeleteReply, error)
JobList(context.Context, *JobListRequest) (*JobListReply, error)
JobCreate(context.Context, *JobCreateRequest) (*JobCreateReply, error)
JobDelete(context.Context, *JobDeleteRequest) (*JobDeleteReply, error)
JobNext(context.Context, *JobNextRequest) (*JobNextReply, error)
JobDisplay(context.Context, *JobDisplayRequest) (*JobDisplayReply, error)
JobGetLog(context.Context, *JobGetLogRequest) (*JobGetLogReply, error)
SourceList(context.Context, *SourceListRequest) (*SourceListReply, error)
DeviceList(context.Context, *DeviceListRequest) (*DeviceListReply, error)
LibraryExport(context.Context, *LibraryExportRequest) (*LibraryExportReply, error)
mustEmbedUnimplementedServiceServer()
}
@@ -201,8 +234,11 @@ func (UnimplementedServiceServer) FileDelete(context.Context, *FileDeleteRequest
func (UnimplementedServiceServer) FileListParents(context.Context, *FileListParentsRequest) (*FileListParentsReply, error) {
return nil, status.Errorf(codes.Unimplemented, "method FileListParents not implemented")
}
func (UnimplementedServiceServer) TapeMGet(context.Context, *TapeMGetRequest) (*TapeMGetReply, error) {
return nil, status.Errorf(codes.Unimplemented, "method TapeMGet not implemented")
func (UnimplementedServiceServer) TapeList(context.Context, *TapeListRequest) (*TapeListReply, error) {
return nil, status.Errorf(codes.Unimplemented, "method TapeList not implemented")
}
func (UnimplementedServiceServer) TapeDelete(context.Context, *TapeDeleteRequest) (*TapeDeleteReply, error) {
return nil, status.Errorf(codes.Unimplemented, "method TapeDelete not implemented")
}
func (UnimplementedServiceServer) JobList(context.Context, *JobListRequest) (*JobListReply, error) {
return nil, status.Errorf(codes.Unimplemented, "method JobList not implemented")
@@ -210,6 +246,9 @@ func (UnimplementedServiceServer) JobList(context.Context, *JobListRequest) (*Jo
func (UnimplementedServiceServer) JobCreate(context.Context, *JobCreateRequest) (*JobCreateReply, error) {
return nil, status.Errorf(codes.Unimplemented, "method JobCreate not implemented")
}
func (UnimplementedServiceServer) JobDelete(context.Context, *JobDeleteRequest) (*JobDeleteReply, error) {
return nil, status.Errorf(codes.Unimplemented, "method JobDelete not implemented")
}
func (UnimplementedServiceServer) JobNext(context.Context, *JobNextRequest) (*JobNextReply, error) {
return nil, status.Errorf(codes.Unimplemented, "method JobNext not implemented")
}
@@ -225,6 +264,9 @@ func (UnimplementedServiceServer) SourceList(context.Context, *SourceListRequest
func (UnimplementedServiceServer) DeviceList(context.Context, *DeviceListRequest) (*DeviceListReply, error) {
return nil, status.Errorf(codes.Unimplemented, "method DeviceList not implemented")
}
func (UnimplementedServiceServer) LibraryExport(context.Context, *LibraryExportRequest) (*LibraryExportReply, error) {
return nil, status.Errorf(codes.Unimplemented, "method LibraryExport not implemented")
}
func (UnimplementedServiceServer) mustEmbedUnimplementedServiceServer() {}
// UnsafeServiceServer may be embedded to opt out of forward compatibility for this service.
@@ -328,20 +370,38 @@ func _Service_FileListParents_Handler(srv interface{}, ctx context.Context, dec
return interceptor(ctx, in, info, handler)
}
func _Service_TapeMGet_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(TapeMGetRequest)
func _Service_TapeList_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(TapeListRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(ServiceServer).TapeMGet(ctx, in)
return srv.(ServiceServer).TapeList(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: "/service.Service/TapeMGet",
FullMethod: "/service.Service/TapeList",
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(ServiceServer).TapeMGet(ctx, req.(*TapeMGetRequest))
return srv.(ServiceServer).TapeList(ctx, req.(*TapeListRequest))
}
return interceptor(ctx, in, info, handler)
}
func _Service_TapeDelete_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(TapeDeleteRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(ServiceServer).TapeDelete(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: "/service.Service/TapeDelete",
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(ServiceServer).TapeDelete(ctx, req.(*TapeDeleteRequest))
}
return interceptor(ctx, in, info, handler)
}
@@ -382,6 +442,24 @@ func _Service_JobCreate_Handler(srv interface{}, ctx context.Context, dec func(i
return interceptor(ctx, in, info, handler)
}
func _Service_JobDelete_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(JobDeleteRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(ServiceServer).JobDelete(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: "/service.Service/JobDelete",
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(ServiceServer).JobDelete(ctx, req.(*JobDeleteRequest))
}
return interceptor(ctx, in, info, handler)
}
func _Service_JobNext_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(JobNextRequest)
if err := dec(in); err != nil {
@@ -472,6 +550,24 @@ func _Service_DeviceList_Handler(srv interface{}, ctx context.Context, dec func(
return interceptor(ctx, in, info, handler)
}
func _Service_LibraryExport_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(LibraryExportRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(ServiceServer).LibraryExport(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: "/service.Service/LibraryExport",
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(ServiceServer).LibraryExport(ctx, req.(*LibraryExportRequest))
}
return interceptor(ctx, in, info, handler)
}
// Service_ServiceDesc is the grpc.ServiceDesc for Service service.
// It's only intended for direct use with grpc.RegisterService,
// and not to be introspected or modified (even as a copy)
@@ -500,8 +596,12 @@ var Service_ServiceDesc = grpc.ServiceDesc{
Handler: _Service_FileListParents_Handler,
},
{
MethodName: "TapeMGet",
Handler: _Service_TapeMGet_Handler,
MethodName: "TapeList",
Handler: _Service_TapeList_Handler,
},
{
MethodName: "TapeDelete",
Handler: _Service_TapeDelete_Handler,
},
{
MethodName: "JobList",
@@ -511,6 +611,10 @@ var Service_ServiceDesc = grpc.ServiceDesc{
MethodName: "JobCreate",
Handler: _Service_JobCreate_Handler,
},
{
MethodName: "JobDelete",
Handler: _Service_JobDelete_Handler,
},
{
MethodName: "JobNext",
Handler: _Service_JobNext_Handler,
@@ -531,6 +635,10 @@ var Service_ServiceDesc = grpc.ServiceDesc{
MethodName: "DeviceList",
Handler: _Service_DeviceList_Handler,
},
{
MethodName: "LibraryExport",
Handler: _Service_LibraryExport_Handler,
},
},
Streams: []grpc.StreamDesc{},
Metadata: "service.proto",
+4 -1
View File
@@ -11,7 +11,10 @@ func NewSourceFromACPJob(job *acp.Job) *Source {
}
func (x *Source) RealPath() string {
return x.Base + path.Join(x.Path...)
p := make([]string, 0, len(x.Path)+1)
p = append(p, x.Base)
p = append(p, x.Path...)
return path.Join(p...)
}
func (x *Source) Append(more ...string) *Source {
+1 -1
View File
@@ -223,7 +223,7 @@ func (x *SourceState) GetStatus() CopyStatus {
if x != nil {
return x.Status
}
return CopyStatus_Draft
return CopyStatus_DRAFT
}
func (x *SourceState) GetMessage() string {
+82 -7
View File
@@ -123,6 +123,61 @@ func (x *Tape) GetWritenBytes() int64 {
return 0
}
type TapeFilter struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
Limit *int64 `protobuf:"varint,33,opt,name=limit,proto3,oneof" json:"limit,omitempty"`
Offset *int64 `protobuf:"varint,34,opt,name=offset,proto3,oneof" json:"offset,omitempty"`
}
func (x *TapeFilter) Reset() {
*x = TapeFilter{}
if protoimpl.UnsafeEnabled {
mi := &file_tape_proto_msgTypes[1]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *TapeFilter) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*TapeFilter) ProtoMessage() {}
func (x *TapeFilter) ProtoReflect() protoreflect.Message {
mi := &file_tape_proto_msgTypes[1]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use TapeFilter.ProtoReflect.Descriptor instead.
func (*TapeFilter) Descriptor() ([]byte, []int) {
return file_tape_proto_rawDescGZIP(), []int{1}
}
func (x *TapeFilter) GetLimit() int64 {
if x != nil && x.Limit != nil {
return *x.Limit
}
return 0
}
func (x *TapeFilter) GetOffset() int64 {
if x != nil && x.Offset != nil {
return *x.Offset
}
return 0
}
var File_tape_proto protoreflect.FileDescriptor
var file_tape_proto_rawDesc = []byte{
@@ -143,10 +198,16 @@ var file_tape_proto_rawDesc = []byte{
0x63, 0x69, 0x74, 0x79, 0x42, 0x79, 0x74, 0x65, 0x73, 0x12, 0x21, 0x0a, 0x0c, 0x77, 0x72, 0x69,
0x74, 0x65, 0x6e, 0x5f, 0x62, 0x79, 0x74, 0x65, 0x73, 0x18, 0x14, 0x20, 0x01, 0x28, 0x03, 0x52,
0x0b, 0x77, 0x72, 0x69, 0x74, 0x65, 0x6e, 0x42, 0x79, 0x74, 0x65, 0x73, 0x42, 0x0f, 0x0a, 0x0d,
0x5f, 0x64, 0x65, 0x73, 0x74, 0x72, 0x6f, 0x79, 0x5f, 0x74, 0x69, 0x6d, 0x65, 0x42, 0x28, 0x5a,
0x26, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x61, 0x62, 0x63, 0x39,
0x35, 0x30, 0x33, 0x30, 0x39, 0x2f, 0x74, 0x61, 0x70, 0x65, 0x77, 0x72, 0x69, 0x74, 0x65, 0x72,
0x2f, 0x65, 0x6e, 0x74, 0x69, 0x74, 0x79, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
0x5f, 0x64, 0x65, 0x73, 0x74, 0x72, 0x6f, 0x79, 0x5f, 0x74, 0x69, 0x6d, 0x65, 0x22, 0x59, 0x0a,
0x0a, 0x54, 0x61, 0x70, 0x65, 0x46, 0x69, 0x6c, 0x74, 0x65, 0x72, 0x12, 0x19, 0x0a, 0x05, 0x6c,
0x69, 0x6d, 0x69, 0x74, 0x18, 0x21, 0x20, 0x01, 0x28, 0x03, 0x48, 0x00, 0x52, 0x05, 0x6c, 0x69,
0x6d, 0x69, 0x74, 0x88, 0x01, 0x01, 0x12, 0x1b, 0x0a, 0x06, 0x6f, 0x66, 0x66, 0x73, 0x65, 0x74,
0x18, 0x22, 0x20, 0x01, 0x28, 0x03, 0x48, 0x01, 0x52, 0x06, 0x6f, 0x66, 0x66, 0x73, 0x65, 0x74,
0x88, 0x01, 0x01, 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x6c, 0x69, 0x6d, 0x69, 0x74, 0x42, 0x09, 0x0a,
0x07, 0x5f, 0x6f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x42, 0x28, 0x5a, 0x26, 0x67, 0x69, 0x74, 0x68,
0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x61, 0x62, 0x63, 0x39, 0x35, 0x30, 0x33, 0x30, 0x39,
0x2f, 0x74, 0x61, 0x70, 0x65, 0x77, 0x72, 0x69, 0x74, 0x65, 0x72, 0x2f, 0x65, 0x6e, 0x74, 0x69,
0x74, 0x79, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
}
var (
@@ -161,9 +222,10 @@ func file_tape_proto_rawDescGZIP() []byte {
return file_tape_proto_rawDescData
}
var file_tape_proto_msgTypes = make([]protoimpl.MessageInfo, 1)
var file_tape_proto_msgTypes = make([]protoimpl.MessageInfo, 2)
var file_tape_proto_goTypes = []interface{}{
(*Tape)(nil), // 0: tape.Tape
(*Tape)(nil), // 0: tape.Tape
(*TapeFilter)(nil), // 1: tape.TapeFilter
}
var file_tape_proto_depIdxs = []int32{
0, // [0:0] is the sub-list for method output_type
@@ -191,15 +253,28 @@ func file_tape_proto_init() {
return nil
}
}
file_tape_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*TapeFilter); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
}
file_tape_proto_msgTypes[0].OneofWrappers = []interface{}{}
file_tape_proto_msgTypes[1].OneofWrappers = []interface{}{}
type x struct{}
out := protoimpl.TypeBuilder{
File: protoimpl.DescBuilder{
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
RawDescriptor: file_tape_proto_rawDesc,
NumEnums: 0,
NumMessages: 1,
NumMessages: 2,
NumExtensions: 0,
NumServices: 0,
},
+5
View File
@@ -13,3 +13,8 @@ message Tape {
int64 capacity_bytes = 19;
int64 writen_bytes = 20;
}
message TapeFilter {
optional int64 limit = 33;
optional int64 offset = 34;
}
+45 -14
View File
@@ -21,27 +21,35 @@ type Executor struct {
devicesLock sync.Mutex
availableDevices mapset.Set[string]
workDirectory string
encryptScript string
mkfsScript string
mountScript string
umountScript string
paths Paths
scripts Scripts
}
type Paths struct {
Work string `yaml:"work"`
Source string `yaml:"source"`
Target string `yaml:"target"`
}
type Scripts struct {
Encrypt string `yaml:"encrypt"`
Mkfs string `yaml:"mkfs"`
Mount string `yaml:"mount"`
Umount string `yaml:"umount"`
ReadInfo string `yaml:"read_info"`
}
func New(
db *gorm.DB, lib *library.Library,
devices []string, workDirectory string,
encryptScript, mkfsScript, mountScript, umountScript string,
devices []string, paths Paths, scripts Scripts,
) *Executor {
return &Executor{
db: db,
lib: lib,
devices: devices,
availableDevices: mapset.NewThreadUnsafeSet(devices...),
encryptScript: encryptScript,
mkfsScript: mkfsScript,
mountScript: mountScript,
umountScript: umountScript,
paths: paths,
scripts: scripts,
}
}
@@ -80,7 +88,7 @@ func (e *Executor) releaseDevice(dev string) {
}
func (e *Executor) Start(ctx context.Context, job *Job) error {
job.Status = entity.JobStatus_Processing
job.Status = entity.JobStatus_PROCESSING
if _, err := e.SaveJob(ctx, job); err != nil {
return err
}
@@ -91,12 +99,18 @@ func (e *Executor) Start(ctx context.Context, job *Job) error {
}
return nil
}
if state := job.State.GetRestore(); state != nil {
if err := e.startRestore(ctx, job); err != nil {
return err
}
return nil
}
return fmt.Errorf("unexpected state type, %T", job.State.State)
}
func (e *Executor) Submit(ctx context.Context, job *Job, param *entity.JobNextParam) error {
if job.Status != entity.JobStatus_Processing {
if job.Status != entity.JobStatus_PROCESSING {
return fmt.Errorf("target job is not on processing, status= %s", job.Status)
}
@@ -109,12 +123,21 @@ func (e *Executor) Submit(ctx context.Context, job *Job, param *entity.JobNextPa
exe.submit(ctx, param.GetArchive())
return nil
}
if state := job.State.GetRestore(); state != nil {
exe, err := e.newRestoreExecutor(ctx, job)
if err != nil {
return err
}
exe.submit(ctx, param.GetRestore())
return nil
}
return fmt.Errorf("unexpected state type, %T", job.State.State)
}
func (e *Executor) Display(ctx context.Context, job *Job) (*entity.JobDisplay, error) {
if job.Status != entity.JobStatus_Processing {
if job.Status != entity.JobStatus_PROCESSING {
return nil, fmt.Errorf("target job is not on processing, status= %s", job.Status)
}
@@ -126,6 +149,14 @@ func (e *Executor) Display(ctx context.Context, job *Job) (*entity.JobDisplay, e
return &entity.JobDisplay{Display: &entity.JobDisplay_Archive{Archive: display}}, nil
}
if state := job.State.GetRestore(); state != nil {
display, err := e.getRestoreDisplay(ctx, job)
if err != nil {
return nil, err
}
return &entity.JobDisplay{Display: &entity.JobDisplay_Restore{Restore: display}}, nil
}
return nil, fmt.Errorf("unexpected state type, %T", job.State.State)
}
+11 -1
View File
@@ -35,7 +35,10 @@ func (j *Job) BeforeUpdate(tx *gorm.DB) error {
func (e *Executor) initJob(ctx context.Context, job *Job, param *entity.JobParam) error {
if p := param.GetArchive(); p != nil {
return e.initArchive(ctx, job, p)
return e.createArchive(ctx, job, p)
}
if p := param.GetRestore(); p != nil {
return e.createRestore(ctx, job, p)
}
return fmt.Errorf("unexpected param type, %T", param.Param)
}
@@ -52,6 +55,13 @@ func (e *Executor) CreateJob(ctx context.Context, job *Job, param *entity.JobPar
return job, nil
}
func (e *Executor) DeleteJobs(ctx context.Context, ids ...int64) error {
if r := e.db.WithContext(ctx).Delete(ModelJob, ids); r.Error != nil {
return fmt.Errorf("delete job fail, err= %w", r.Error)
}
return nil
}
func (e *Executor) SaveJob(ctx context.Context, job *Job) (*Job, error) {
if r := e.db.WithContext(ctx).Save(job); r.Error != nil {
return nil, fmt.Errorf("save job fail, err= %w", r.Error)
+2 -2
View File
@@ -7,8 +7,8 @@ import (
"github.com/abc950309/tapewriter/entity"
)
func (e *Executor) getArchiveDisplay(ctx context.Context, job *Job) (*entity.JobDisplayArchive, error) {
display := new(entity.JobDisplayArchive)
func (e *Executor) getArchiveDisplay(ctx context.Context, job *Job) (*entity.JobArchiveDisplay, error) {
display := new(entity.JobArchiveDisplay)
if exe := e.getArchiveExecutor(ctx, job); exe != nil && exe.progress != nil {
display.CopyedBytes = atomic.LoadInt64(&exe.progress.bytes)
+28 -17
View File
@@ -64,7 +64,7 @@ type jobArchiveExecutor struct {
job *Job
stateLock sync.Mutex
state *entity.JobStateArchive
state *entity.JobArchiveState
progress *progress
logFile *os.File
@@ -79,7 +79,10 @@ func (a *jobArchiveExecutor) submit(ctx context.Context, param *entity.JobArchiv
func (a *jobArchiveExecutor) handle(ctx context.Context, param *entity.JobArchiveNextParam) error {
if p := param.GetCopying(); p != nil {
if err := a.switchStep(ctx, entity.JobArchiveStep_Copying, entity.JobStatus_Processing, mapset.NewThreadUnsafeSet(entity.JobArchiveStep_WaitForTape)); err != nil {
if err := a.switchStep(
ctx, entity.JobArchiveStep_COPYING, entity.JobStatus_PROCESSING,
mapset.NewThreadUnsafeSet(entity.JobArchiveStep_WAIT_FOR_TAPE),
); err != nil {
return err
}
@@ -87,7 +90,7 @@ func (a *jobArchiveExecutor) handle(ctx context.Context, param *entity.JobArchiv
go tools.WrapWithLogger(ctx, a.logger, func() {
defer tools.Done()
if err := a.makeTape(tools.ShutdownContext, p.Device, p.Barcode, p.Name); err != nil {
a.logger.WithContext(ctx).WithError(err).Errorf("make type has error, barcode= '%s' name= '%s'", p.Barcode, p.Name)
a.logger.WithContext(ctx).WithError(err).Errorf("make tape has error, barcode= '%s' name= '%s'", p.Barcode, p.Name)
}
})
@@ -95,11 +98,17 @@ func (a *jobArchiveExecutor) handle(ctx context.Context, param *entity.JobArchiv
}
if p := param.GetWaitForTape(); p != nil {
return a.switchStep(ctx, entity.JobArchiveStep_WaitForTape, entity.JobStatus_Processing, mapset.NewThreadUnsafeSet(entity.JobArchiveStep_Pending, entity.JobArchiveStep_Copying))
return a.switchStep(
ctx, entity.JobArchiveStep_WAIT_FOR_TAPE, entity.JobStatus_PROCESSING,
mapset.NewThreadUnsafeSet(entity.JobArchiveStep_PENDING, entity.JobArchiveStep_COPYING),
)
}
if p := param.GetFinished(); p != nil {
if err := a.switchStep(ctx, entity.JobArchiveStep_Finished, entity.JobStatus_Completed, mapset.NewThreadUnsafeSet(entity.JobArchiveStep_Copying)); err != nil {
if err := a.switchStep(
ctx, entity.JobArchiveStep_FINISHED, entity.JobStatus_COMPLETED,
mapset.NewThreadUnsafeSet(entity.JobArchiveStep_COPYING),
); err != nil {
return err
}
@@ -128,7 +137,7 @@ func (a *jobArchiveExecutor) makeTape(ctx context.Context, device, barcode, name
return fmt.Errorf("run encrypt script fail, %w", err)
}
mkfsCmd := exec.CommandContext(ctx, a.exe.mkfsScript)
mkfsCmd := exec.CommandContext(ctx, a.exe.scripts.Mkfs)
mkfsCmd.Env = append(mkfsCmd.Env, fmt.Sprintf("DEVICE=%s", device), fmt.Sprintf("TAPE_BARCODE=%s", barcode), fmt.Sprintf("TAPE_NAME=%s", name))
if err := runCmd(a.logger, mkfsCmd); err != nil {
return fmt.Errorf("run mkfs script fail, %w", err)
@@ -139,13 +148,13 @@ func (a *jobArchiveExecutor) makeTape(ctx context.Context, device, barcode, name
return fmt.Errorf("create temp mountpoint, %w", err)
}
mountCmd := exec.CommandContext(ctx, a.exe.mountScript)
mountCmd := exec.CommandContext(ctx, a.exe.scripts.Mount)
mountCmd.Env = append(mountCmd.Env, fmt.Sprintf("DEVICE=%s", device), fmt.Sprintf("MOUNT_POINT=%s", mountPoint))
if err := runCmd(a.logger, mountCmd); err != nil {
return fmt.Errorf("run mount script fail, %w", err)
}
defer func() {
umountCmd := exec.CommandContext(tools.WithoutTimeout(ctx), a.exe.umountScript)
umountCmd := exec.CommandContext(tools.WithoutTimeout(ctx), a.exe.scripts.Umount)
umountCmd.Env = append(umountCmd.Env, fmt.Sprintf("MOUNT_POINT=%s", mountPoint))
if err := runCmd(a.logger, umountCmd); err != nil {
a.logger.WithContext(ctx).WithError(err).Errorf("run umount script fail, %s", mountPoint)
@@ -157,15 +166,17 @@ func (a *jobArchiveExecutor) makeTape(ctx context.Context, device, barcode, name
}
}()
opts := make([]acp.Option, 0, 4)
wildcardJobOpts := make([]acp.WildcardJobOption, 0, 6)
wildcardJobOpts = append(wildcardJobOpts, acp.Target(mountPoint))
for _, source := range a.state.Sources {
if source.Status == entity.CopyStatus_Submited {
if source.Status == entity.CopyStatus_SUBMITED {
continue
}
opts = append(opts, acp.AccurateSource(source.Source.Base, source.Source.Path))
wildcardJobOpts = append(wildcardJobOpts, acp.AccurateSource(source.Source.Base, source.Source.Path))
}
opts = append(opts, acp.Target(mountPoint))
opts := make([]acp.Option, 0, 4)
opts = append(opts, acp.WildcardJob(wildcardJobOpts...))
opts = append(opts, acp.WithHash(true))
opts = append(opts, acp.SetToDevice(acp.LinearDevice(true)))
opts = append(opts, acp.WithLogger(a.logger))
@@ -196,12 +207,12 @@ func (a *jobArchiveExecutor) makeTape(ctx context.Context, device, barcode, name
var targetStatus entity.CopyStatus
switch job.Status {
case "pending":
targetStatus = entity.CopyStatus_Pending
targetStatus = entity.CopyStatus_PENDING
case "preparing":
targetStatus = entity.CopyStatus_Running
targetStatus = entity.CopyStatus_RUNNING
case "finished":
a.logger.WithContext(ctx).Infof("file '%s' copy finished, size= %d", src.RealPath(), job.Size)
targetStatus = entity.CopyStatus_Staged
targetStatus = entity.CopyStatus_STAGED
for dst, err := range job.FailTargets {
if err == nil {
@@ -346,7 +357,7 @@ func (a *jobArchiveExecutor) markSourcesAsSubmited(ctx context.Context, jobs []*
continue
}
target.Status = entity.CopyStatus_Submited
target.Status = entity.CopyStatus_SUBMITED
}
if _, err := a.exe.SaveJob(ctx, a.job); err != nil {
@@ -361,7 +372,7 @@ func (a *jobArchiveExecutor) getTodoSources() int {
var todo int
for _, s := range a.state.Sources {
if s.Status == entity.CopyStatus_Submited {
if s.Status == entity.CopyStatus_SUBMITED {
continue
}
todo++
+11 -4
View File
@@ -4,16 +4,23 @@ import (
"context"
"fmt"
"os"
"path"
"sort"
"strings"
"github.com/abc950309/acp"
"github.com/abc950309/tapewriter/entity"
)
func (e *Executor) initArchive(ctx context.Context, job *Job, param *entity.JobParamArchive) error {
func (e *Executor) createArchive(ctx context.Context, job *Job, param *entity.JobArchiveParam) error {
var err error
sources := make([]*entity.SourceState, 0, len(param.Sources)*8)
for _, src := range param.Sources {
src.Base = strings.TrimSpace(src.Base)
if src.Base[0] != '/' {
src.Base = path.Join(e.paths.Source, src.Base) + "/"
}
sources, err = walk(ctx, src, sources)
if err != nil {
return err
@@ -29,8 +36,8 @@ func (e *Executor) initArchive(ctx context.Context, job *Job, param *entity.JobP
}
}
job.State = &entity.JobState{State: &entity.JobState_Archive{Archive: &entity.JobStateArchive{
Step: entity.JobArchiveStep_Pending,
job.State = &entity.JobState{State: &entity.JobState_Archive{Archive: &entity.JobArchiveState{
Step: entity.JobArchiveStep_PENDING,
Sources: sources,
}}}
return nil
@@ -52,7 +59,7 @@ func walk(ctx context.Context, src *entity.Source, sources []*entity.SourceState
return append(sources, &entity.SourceState{
Source: src,
Size: stat.Size(),
Status: entity.CopyStatus_Pending,
Status: entity.CopyStatus_PENDING,
}), nil
}
if mode&acp.UnexpectFileMode != 0 {
+6 -6
View File
@@ -11,13 +11,13 @@ import (
"github.com/sirupsen/logrus"
)
func (e *Executor) RestoreLoadTape(ctx context.Context, device string, tape *library.Tape) error {
if !e.occupyDevice(device) {
func (e *jobRestoreExecutor) loadTape(ctx context.Context, device string, tape *library.Tape) error {
if !e.exe.occupyDevice(device) {
return fmt.Errorf("device is using, device= %s", device)
}
defer e.releaseDevice(device)
defer e.exe.releaseDevice(device)
keyPath, keyRecycle, err := e.restoreKey(tape.Encryption)
keyPath, keyRecycle, err := e.exe.restoreKey(tape.Encryption)
if err != nil {
return err
}
@@ -28,7 +28,7 @@ func (e *Executor) RestoreLoadTape(ctx context.Context, device string, tape *lib
logger := logrus.StandardLogger()
if err := runCmd(logger, e.makeEncryptCmd(ctx, device, keyPath, tape.Barcode, tape.Name)); err != nil {
if err := runCmd(logger, e.exe.makeEncryptCmd(ctx, device, keyPath, tape.Barcode, tape.Name)); err != nil {
return fmt.Errorf("run encrypt script fail, %w", err)
}
@@ -37,7 +37,7 @@ func (e *Executor) RestoreLoadTape(ctx context.Context, device string, tape *lib
return fmt.Errorf("create temp mountpoint, %w", err)
}
mountCmd := exec.CommandContext(ctx, e.mountScript)
mountCmd := exec.CommandContext(ctx, e.exe.scripts.Mount)
mountCmd.Env = append(mountCmd.Env, fmt.Sprintf("DEVICE=%s", device), fmt.Sprintf("MOUNT_POINT=%s", mountPoint))
if err := runCmd(logger, mountCmd); err != nil {
return fmt.Errorf("run mount script fail, %w", err)
+25
View File
@@ -0,0 +1,25 @@
package executor
import (
"context"
"sync/atomic"
"github.com/abc950309/tapewriter/entity"
)
func (e *Executor) getRestoreDisplay(ctx context.Context, job *Job) (*entity.JobRestoreDisplay, error) {
display := new(entity.JobRestoreDisplay)
if exe := e.getRestoreExecutor(ctx, job); exe != nil && exe.progress != nil {
display.CopyedBytes = atomic.LoadInt64(&exe.progress.bytes)
display.CopyedFiles = atomic.LoadInt64(&exe.progress.files)
display.TotalBytes = atomic.LoadInt64(&exe.progress.totalBytes)
display.TotalFiles = atomic.LoadInt64(&exe.progress.totalFiles)
display.StartTime = exe.progress.startTime.Unix()
speed := atomic.LoadInt64(&exe.progress.speed)
display.Speed = &speed
}
return display, nil
}
+321
View File
@@ -0,0 +1,321 @@
package executor
import (
"context"
"fmt"
"io"
"os"
"os/exec"
"path"
"sort"
"strings"
"sync"
"sync/atomic"
"time"
"github.com/abc950309/acp"
"github.com/abc950309/tapewriter/entity"
"github.com/abc950309/tapewriter/tools"
mapset "github.com/deckarep/golang-set/v2"
jsoniter "github.com/json-iterator/go"
"github.com/samber/lo"
"github.com/sirupsen/logrus"
)
var (
runningRestores sync.Map
)
func (e *Executor) getRestoreExecutor(ctx context.Context, job *Job) *jobRestoreExecutor {
if running, has := runningRestores.Load(job.ID); has {
return running.(*jobRestoreExecutor)
}
return nil
}
func (e *Executor) newRestoreExecutor(ctx context.Context, job *Job) (*jobRestoreExecutor, error) {
if exe := e.getRestoreExecutor(ctx, job); exe != nil {
return exe, nil
}
logFile, err := e.newLogWriter(job.ID)
if err != nil {
return nil, fmt.Errorf("get log writer fail, %w", err)
}
logger := logrus.New()
logger.SetOutput(io.MultiWriter(os.Stderr, logFile))
exe := &jobRestoreExecutor{
exe: e,
job: job,
state: job.State.GetRestore(),
logFile: logFile,
logger: logger,
}
runningRestores.Store(job.ID, exe)
return exe, nil
}
type jobRestoreExecutor struct {
exe *Executor
job *Job
stateLock sync.Mutex
state *entity.JobRestoreState
progress *progress
logFile *os.File
logger *logrus.Logger
}
func (a *jobRestoreExecutor) submit(ctx context.Context, param *entity.JobRestoreNextParam) {
if err := a.handle(ctx, param); err != nil {
a.logger.WithContext(ctx).Infof("handler param fail, err= %w", err)
}
}
func (a *jobRestoreExecutor) handle(ctx context.Context, param *entity.JobRestoreNextParam) error {
if p := param.GetCopying(); p != nil {
if err := a.switchStep(
ctx, entity.JobRestoreStep_COPYING, entity.JobStatus_PROCESSING,
mapset.NewThreadUnsafeSet(entity.JobRestoreStep_WAIT_FOR_TAPE),
); err != nil {
return err
}
tools.Working()
go tools.WrapWithLogger(ctx, a.logger, func() {
defer tools.Done()
if err := a.restoreTape(tools.ShutdownContext, p.Device); err != nil {
a.logger.WithContext(ctx).WithError(err).Errorf("restore tape has error, device= '%s'", p.Device)
}
})
return nil
}
if p := param.GetWaitForTape(); p != nil {
return a.switchStep(
ctx, entity.JobRestoreStep_WAIT_FOR_TAPE, entity.JobStatus_PROCESSING,
mapset.NewThreadUnsafeSet(entity.JobRestoreStep_PENDING, entity.JobRestoreStep_COPYING),
)
}
if p := param.GetFinished(); p != nil {
if err := a.switchStep(
ctx, entity.JobRestoreStep_FINISHED, entity.JobStatus_COMPLETED,
mapset.NewThreadUnsafeSet(entity.JobRestoreStep_COPYING),
); err != nil {
return err
}
a.logFile.Close()
runningRestores.Delete(a.job.ID)
return nil
}
return nil
}
func (a *jobRestoreExecutor) restoreTape(ctx context.Context, device string) (rerr error) {
if !a.exe.occupyDevice(device) {
return fmt.Errorf("device is using, device= %s", device)
}
defer a.exe.releaseDevice(device)
defer func() {
if _, found := lo.Find(a.state.Tapes, func(item *entity.RestoreTape) bool {
return item.Status != entity.CopyStatus_SUBMITED
}); found {
a.submit(tools.WithoutTimeout(ctx), &entity.JobRestoreNextParam{
Param: &entity.JobRestoreNextParam_WaitForTape{WaitForTape: &entity.JobRestoreWaitForTapeParam{}},
})
return
}
a.submit(tools.WithoutTimeout(ctx), &entity.JobRestoreNextParam{
Param: &entity.JobRestoreNextParam_Finished{Finished: &entity.JobRestoreFinishedParam{}},
})
}()
readInfoCmd := exec.CommandContext(ctx, a.exe.scripts.ReadInfo)
readInfoCmd.Env = append(readInfoCmd.Env, fmt.Sprintf("DEVICE=%s", device))
infoBuf, err := runCmdWithReturn(a.logger, readInfoCmd)
if err != nil {
return fmt.Errorf("run read info script fail, %w", err)
}
barcode := jsoniter.Get(infoBuf, "barcode").ToString()
if len(barcode) > 6 {
barcode = barcode[:6]
}
restoreTape, found := lo.Find(a.state.Tapes, func(t *entity.RestoreTape) bool {
return t.Barcode == barcode
})
if !found || restoreTape == nil {
expects := lo.Map(a.state.Tapes, func(t *entity.RestoreTape, _ int) string { return t.Barcode })
return fmt.Errorf("unexpected tape barcode in library, has= '%s' expect= %v", barcode, expects)
}
if restoreTape.Status != entity.CopyStatus_PENDING {
return fmt.Errorf("unexpected restore tape state status, has= '%s' expect= '%s'", restoreTape.Status, entity.CopyStatus_PENDING)
}
tape, err := a.exe.lib.GetTape(ctx, restoreTape.TapeId)
if err != nil {
return fmt.Errorf("get tape info fail, barcode= '%s' id= %d, %w", restoreTape.Barcode, restoreTape.TapeId, err)
}
keyPath, keyRecycle, err := a.exe.restoreKey(tape.Encryption)
if err != nil {
return err
}
defer func() {
time.Sleep(time.Second)
keyRecycle()
}()
if err := runCmd(a.logger, a.exe.makeEncryptCmd(ctx, device, keyPath, barcode, tape.Name)); err != nil {
return fmt.Errorf("run encrypt script fail, %w", err)
}
mountPoint, err := os.MkdirTemp("", "*.ltfs")
if err != nil {
return fmt.Errorf("create temp mountpoint, %w", err)
}
sourcePath := tools.Cache(func(p string) string { return path.Join(mountPoint, p) })
mountCmd := exec.CommandContext(ctx, a.exe.scripts.Mount)
mountCmd.Env = append(mountCmd.Env, fmt.Sprintf("DEVICE=%s", device), fmt.Sprintf("MOUNT_POINT=%s", mountPoint))
if err := runCmd(a.logger, mountCmd); err != nil {
return fmt.Errorf("run mount script fail, %w", err)
}
defer func() {
umountCmd := exec.CommandContext(tools.WithoutTimeout(ctx), a.exe.scripts.Umount)
umountCmd.Env = append(umountCmd.Env, fmt.Sprintf("MOUNT_POINT=%s", mountPoint))
if err := runCmd(a.logger, umountCmd); err != nil {
a.logger.WithContext(ctx).WithError(err).Errorf("run umount script fail, %s", mountPoint)
return
}
if err := os.Remove(mountPoint); err != nil {
a.logger.WithContext(ctx).WithError(err).Errorf("remove mount point fail, %s", mountPoint)
return
}
}()
opts := make([]acp.Option, 0, 4)
for _, f := range restoreTape.Files {
if f.Status == entity.CopyStatus_SUBMITED {
continue
}
opts = append(opts, acp.AccurateJob(sourcePath(f.TapePath), []string{path.Join(a.exe.paths.Target, f.TargetPath)}))
}
opts = append(opts, acp.WithHash(true))
opts = append(opts, acp.SetFromDevice(acp.LinearDevice(true)))
opts = append(opts, acp.WithLogger(a.logger))
a.progress = newProgress()
defer func() { a.progress = nil }()
convertPath := tools.Cache(func(p string) string { return strings.ReplaceAll(p, "/", "\x00") })
opts = append(opts, acp.WithEventHandler(func(ev acp.Event) {
switch e := ev.(type) {
case *acp.EventUpdateCount:
atomic.StoreInt64(&a.progress.totalBytes, e.Bytes)
atomic.StoreInt64(&a.progress.totalFiles, e.Files)
return
case *acp.EventUpdateProgress:
a.progress.setBytes(e.Bytes)
atomic.StoreInt64(&a.progress.files, e.Files)
return
case *acp.EventReportError:
a.logger.WithContext(ctx).Errorf("acp report error, src= '%s' dst= '%s' err= '%s'", e.Error.Src, e.Error.Dst, e.Error.Err)
return
case *acp.EventUpdateJob:
job := e.Job
src := entity.NewSourceFromACPJob(job)
var targetStatus entity.CopyStatus
switch job.Status {
case "pending":
targetStatus = entity.CopyStatus_PENDING
case "preparing":
targetStatus = entity.CopyStatus_RUNNING
case "finished":
a.logger.WithContext(ctx).Infof("file '%s' copy finished, size= %d", src.RealPath(), job.Size)
targetStatus = entity.CopyStatus_SUBMITED
if len(job.SuccessTargets) > 0 {
targetStatus = entity.CopyStatus_FAILED
}
for dst, err := range job.FailTargets {
if err == nil {
continue
}
a.logger.WithContext(ctx).WithError(err).Errorf("file '%s' copy fail, dst= '%s'", src.RealPath(), dst)
}
default:
return
}
a.stateLock.Lock()
defer a.stateLock.Unlock()
realPath := src.RealPath()
idx := sort.Search(len(restoreTape.Files), func(idx int) bool {
return convertPath(realPath) < convertPath(sourcePath(restoreTape.Files[idx].TapePath))
})
target := restoreTape.Files[idx]
if target == nil || realPath != sourcePath(target.TapePath) {
return
}
target.Status = targetStatus
if _, err := a.exe.SaveJob(ctx, a.job); err != nil {
logrus.WithContext(ctx).Infof("save job for update file fail, name= %s", job.Base+path.Join(job.Path...))
}
return
}
}))
defer func() {
restoreTape.Status = entity.CopyStatus_SUBMITED
if _, err := a.exe.SaveJob(tools.WithoutTimeout(ctx), a.job); err != nil {
logrus.WithContext(ctx).Infof("save job for submit tape fail, barcode= %s", restoreTape.Barcode)
}
}()
copyer, err := acp.New(ctx, opts...)
if err != nil {
rerr = fmt.Errorf("start copy fail, %w", err)
return
}
copyer.Wait()
return
}
func (a *jobRestoreExecutor) switchStep(ctx context.Context, target entity.JobRestoreStep, status entity.JobStatus, expect mapset.Set[entity.JobRestoreStep]) error {
a.stateLock.Lock()
defer a.stateLock.Unlock()
if !expect.Contains(a.state.Step) {
return fmt.Errorf("unexpected current step, target= '%s' expect= '%s' has= '%s'", target, expect, a.state.Step)
}
a.state.Step = target
a.job.Status = status
if _, err := a.exe.SaveJob(ctx, a.job); err != nil {
return fmt.Errorf("switch to step copying, save job fail, %w", err)
}
return nil
}
+232
View File
@@ -0,0 +1,232 @@
package executor
import (
"context"
"fmt"
"io/fs"
"sort"
"strings"
"github.com/abc950309/tapewriter/entity"
"github.com/abc950309/tapewriter/library"
"github.com/abc950309/tapewriter/tools"
mapset "github.com/deckarep/golang-set/v2"
"github.com/samber/lo"
"github.com/sirupsen/logrus"
)
type restoreFile struct {
*library.File
target string
}
func (e *Executor) createRestore(ctx context.Context, job *Job, param *entity.JobRestoreParam) error {
files, err := e.getRestoreFiles(ctx, param.FileIds...)
if err != nil {
return fmt.Errorf("get restore files fail, ids= %v, %w", param.FileIds, err)
}
fileIDs := make([]int64, 0, len(files))
for _, file := range files {
fileIDs = append(fileIDs, file.ID)
}
positions, err := e.lib.MGetPositionByFileID(ctx, fileIDs...)
if err != nil {
return err
}
tapeMapping := make(map[int64]mapset.Set[int64], 4)
for _, file := range files {
for _, posi := range positions[file.ID] {
set := tapeMapping[posi.TapeID]
if set == nil {
tapeMapping[posi.TapeID] = mapset.NewThreadUnsafeSet(file.ID)
continue
}
set.Add(file.ID)
}
}
tapeMap, err := e.lib.MGetTape(ctx, lo.Keys(tapeMapping)...)
if err != nil {
return err
}
for tapeID := range tapeMapping {
if tape, has := tapeMap[tapeID]; has && tape != nil {
continue
}
logrus.WithContext(ctx).Infof("tape not found, tape_id= %d", tapeID)
delete(tapeMap, tapeID)
}
restoreTapes := make([]*entity.RestoreTape, 0, len(tapeMapping))
for len(tapeMapping) > 0 {
var maxTapeID int64
for tapeID, files := range tapeMapping {
if maxTapeID == 0 {
maxTapeID = tapeID
continue
}
diff := files.Cardinality() - tapeMapping[maxTapeID].Cardinality()
if diff > 0 {
maxTapeID = tapeID
continue
}
if diff < 0 {
continue
}
if tapeID < maxTapeID {
maxTapeID = tapeID
continue
}
}
if maxTapeID == 0 {
return fmt.Errorf("max tape not found, tape_ids= %v", lo.Keys(tapeMapping))
}
fileIDs := tapeMapping[maxTapeID]
delete(tapeMapping, maxTapeID)
if fileIDs.Cardinality() == 0 {
continue
}
for i, f := range tapeMapping {
tapeMapping[i] = f.Difference(fileIDs)
}
targets := make([]*entity.RestoreFile, 0, fileIDs.Cardinality())
for _, fileID := range fileIDs.ToSlice() {
file := files[fileID]
if file == nil {
continue
}
posi := positions[fileID]
if len(posi) == 0 {
logrus.WithContext(ctx).Infof("file position not found, file_id= %d", fileID)
continue
}
for _, p := range posi {
if p.TapeID != maxTapeID {
continue
}
targets = append(targets, &entity.RestoreFile{
FileId: file.ID,
TapeId: p.TapeID,
PositionId: p.ID,
Status: entity.CopyStatus_PENDING,
Size: file.Size,
TapePath: p.Path,
TargetPath: file.target,
})
break
}
}
convertPath := tools.Cache(func(p string) string { return strings.ReplaceAll(p, "/", "\x00") })
sort.Slice(targets, func(i, j int) bool {
return convertPath(targets[i].TapePath) < convertPath(targets[j].TapePath)
})
restoreTapes = append(restoreTapes, &entity.RestoreTape{
TapeId: maxTapeID,
Barcode: tapeMap[maxTapeID].Barcode,
Status: entity.CopyStatus_PENDING,
Files: targets,
})
}
job.State = &entity.JobState{State: &entity.JobState_Restore{Restore: &entity.JobRestoreState{
Step: entity.JobRestoreStep_PENDING,
Tapes: restoreTapes,
}}}
return nil
}
func (e *Executor) getRestoreFiles(ctx context.Context, rootIDs ...int64) (map[int64]*restoreFile, error) {
rootIDSet := mapset.NewThreadUnsafeSet(rootIDs...)
for _, id := range rootIDs {
parents, err := e.lib.ListParents(ctx, id)
if err != nil {
return nil, err
}
if len(parents) <= 1 {
continue
}
for _, parent := range parents[:len(parents)-1] {
if !rootIDSet.Contains(parent.ID) {
continue
}
rootIDSet.Remove(id)
break
}
}
rootIDs = rootIDSet.ToSlice()
mapping, err := e.lib.MGetFile(ctx, rootIDs...)
if err != nil {
return nil, fmt.Errorf("mget file fail, ids= %v, %w", rootIDs, err)
}
files := make([]*restoreFile, 0, len(rootIDs)*8)
visited := mapset.NewThreadUnsafeSet[int64]()
for _, root := range mapping {
if visited.Contains(root.ID) {
continue
}
visited.Add(root.ID)
if !fs.FileMode(root.Mode).IsDir() {
files = append(files, &restoreFile{File: root, target: root.Name})
continue
}
found, err := e.visitFiles(ctx, root.Name, nil, visited, root.ID)
if err != nil {
return nil, err
}
files = append(files, found...)
}
results := make(map[int64]*restoreFile, len(files))
for _, f := range files {
results[f.ID] = f
}
return results, nil
}
func (e *Executor) visitFiles(ctx context.Context, path string, files []*restoreFile, visited mapset.Set[int64], parentID int64) ([]*restoreFile, error) {
children, err := e.lib.List(ctx, parentID)
if err != nil {
return nil, err
}
for _, child := range children {
if visited.Contains(child.ID) {
continue
}
visited.Add(child.ID)
target := path + "/" + child.Name
if !fs.FileMode(child.Mode).IsDir() {
files = append(files, &restoreFile{File: child, target: target})
continue
}
files, err = e.visitFiles(ctx, target, files, visited, child.ID)
if err != nil {
return nil, err
}
}
return files, nil
}
+15
View File
@@ -0,0 +1,15 @@
package executor
import (
"context"
"github.com/abc950309/tapewriter/entity"
)
func (e *Executor) startRestore(ctx context.Context, job *Job) error {
return e.Submit(ctx, job, &entity.JobNextParam{Param: &entity.JobNextParam_Restore{
Restore: &entity.JobRestoreNextParam{Param: &entity.JobRestoreNextParam_WaitForTape{
WaitForTape: &entity.JobRestoreWaitForTapeParam{},
}},
}})
}
+1 -1
View File
@@ -48,7 +48,7 @@ func (e *Executor) newKey() (string, string, func(), error) {
}
func (e *Executor) makeEncryptCmd(ctx context.Context, device, keyPath, barcode, name string) *exec.Cmd {
cmd := exec.CommandContext(ctx, e.encryptScript)
cmd := exec.CommandContext(ctx, e.scripts.Encrypt)
cmd.Env = append(cmd.Env, fmt.Sprintf("DEVICE=%s", device), fmt.Sprintf("KEY_FILE=%s", keyPath), fmt.Sprintf("TAPE_BARCODE=%s", barcode), fmt.Sprintf("TAPE_NAME=%s", name))
return cmd
}
+25 -2
View File
@@ -3,6 +3,7 @@ package executor
import (
"errors"
"fmt"
"io/fs"
"os"
"os/exec"
"path"
@@ -11,7 +12,7 @@ import (
)
func (e *Executor) logPath(jobID int64) (string, string) {
return path.Join(e.workDirectory, "job-logs"), fmt.Sprintf("%d.log", jobID)
return path.Join(e.paths.Work, "job-logs"), fmt.Sprintf("%d.log", jobID)
}
func (e *Executor) newLogWriter(jobID int64) (*os.File, error) {
@@ -41,6 +42,28 @@ func (e *Executor) NewLogReader(jobID int64) (*os.File, error) {
return file, nil
}
func runCmdWithReturn(logger *logrus.Logger, cmd *exec.Cmd) ([]byte, error) {
out, err := os.CreateTemp("", "*.out")
if err != nil {
return nil, fmt.Errorf("create cmd out fail, %w", err)
}
out.Chmod(fs.ModePerm)
out.Close()
defer os.Remove(out.Name())
cmd.Env = append(cmd.Env, fmt.Sprintf("OUT=%s", out.Name()))
if err := runCmd(logger, cmd); err != nil {
return nil, err
}
buf, err := os.ReadFile(out.Name())
if err != nil {
return nil, fmt.Errorf("read cmd out fail, %w", err)
}
return buf, nil
}
func runCmd(logger *logrus.Logger, cmd *exec.Cmd) error {
writer := logger.WriterLevel(logrus.InfoLevel)
cmd.Stdout = writer
@@ -50,7 +73,7 @@ func runCmd(logger *logrus.Logger, cmd *exec.Cmd) error {
}
func (e *Executor) reportPath(barcode string) (string, string) {
return path.Join(e.workDirectory, "write-reports"), fmt.Sprintf("%s.log", barcode)
return path.Join(e.paths.Work, "write-reports"), fmt.Sprintf("%s.log", barcode)
}
func (e *Executor) newReportWriter(barcode string) (*os.File, error) {
+1
View File
@@ -0,0 +1 @@
DEV_SERVICE_BASE=http://127.0.0.1:8080
+22
View File
@@ -1,5 +1,6 @@
import { FileData, FileArray, FileAction } from "chonky";
import { defineFileAction } from "chonky";
import { ChonkyActions } from "chonky";
type RenameFileState = {
contextMenuTriggerFile: FileData;
@@ -24,3 +25,24 @@ export const RenameFileAction = defineFileAction({
export const RefreshListAction = defineFileAction({
id: "refresh_list",
} as FileAction);
export const AddFileAction = defineFileAction({
id: "add_file",
__payloadType: ChonkyActions.EndDragNDrop.__payloadType,
} as FileAction);
export const CreateBackupJobAction = defineFileAction({
id: "create_backup_job",
button: {
name: "Create Backup Job",
toolbar: true,
},
} as FileAction);
export const CreateRestoreJobAction = defineFileAction({
id: "create_restore_job",
button: {
name: "Create Restore Job",
toolbar: true,
},
} as FileAction);
+5 -1
View File
@@ -12,6 +12,10 @@ const apiBase: string = (() => {
return base;
})();
export const fileBase: string = (() => {
return apiBase.replace("/services", "/files");
})();
export const ModeDir = 2147483648n; // d: is a directory
export const Root: FileData = {
@@ -70,7 +74,7 @@ export function convertSourceFiles(files: Array<SourceFile>): FileData[] {
openable: isDir,
selectable: true,
draggable: true,
droppable: isDir,
droppable: false,
size: Number(file.size),
modDate: moment.unix(Number(file.modTime)).toDate(),
};
+10 -4
View File
@@ -5,9 +5,11 @@ import Tabs from "@mui/material/Tabs";
import Tab from "@mui/material/Tab";
import { createTheme, ThemeProvider, styled } from "@mui/material/styles";
import { FileBrowser, FileBrowserType } from "./file";
import { BackupBrowser, BackupType } from "./backup";
import { JobsBrowser, JobsType } from "./jobs";
import { FileBrowser, FileBrowserType } from "./pages/file";
import { BackupBrowser, BackupType } from "./pages/backup";
import { RestoreBrowser, RestoreType } from "./pages/restore";
import { TapesBrowser, TapesType } from "./pages/tapes";
import { JobsBrowser, JobsType } from "./pages/jobs";
import "./app.less";
import { sleep } from "./api";
@@ -52,13 +54,17 @@ const App = () => {
<ThemeProvider theme={theme}>
<Tabs className="tabs" value={location.pathname.slice(1)} onChange={handleTabChange} indicatorColor="secondary">
<Tab label="File" value={FileBrowserType} />
<Tab label="Source" value={BackupType} />
<Tab label="Backup" value={BackupType} />
<Tab label="Restore" value={RestoreType} />
<Tab label="Tapes" value={TapesType} />
<Tab label="Jobs" value={JobsType} />
</Tabs>
<Routes>
<Route path="/*">
<Route path={FileBrowserType} element={<Delay inner={<FileBrowser />} />} />
<Route path={BackupType} element={<Delay inner={<BackupBrowser />} />} />
<Route path={RestoreType} element={<Delay inner={<RestoreBrowser />} />} />
<Route path={TapesType} element={<Delay inner={<TapesBrowser />} />} />
<Route path={JobsType} element={<Delay inner={<JobsBrowser />} />} />
<Route path="*" element={<Navigate to={"/" + FileBrowserType} replace />} />
</Route>
-327
View File
@@ -1,327 +0,0 @@
import { useState, useEffect, useMemo, useCallback, FC } from "react";
import Grid from "@mui/material/Grid";
import Box from "@mui/material/Box";
import { FullFileBrowser, FileBrowser, FileNavbar, FileToolbar, FileList, FileContextMenu, FileArray } from "chonky";
import { ChonkyActions, ChonkyFileActionData } from "chonky";
import { DndProvider as UntypedDndProvider, useDrop, DndProviderProps } from "react-dnd";
import { HTML5Backend } from "react-dnd-html5-backend";
import "./app.less";
import { cli, convertSourceFiles } from "./api";
import { Root } from "./api";
import { RenameFileAction, RefreshListAction } from "./actions";
import { useDetailModal, DetailModal, Detail } from "./detail";
const DndProvider = UntypedDndProvider as FC<DndProviderProps<any, any> & { children: JSX.Element[] }>;
const useBackupSourceBrowser = () =>
// openDetailModel: (detail: Detail) => void
{
const [files, setFiles] = useState<FileArray>(Array(1).fill(null));
const [folderChain, setFolderChan] = useState<FileArray>([Root]);
// const currentID = useMemo(() => {
// if (folderChain.length === 0) {
// return "0";
// }
// const last = folderChain.slice(-1)[0];
// if (!last) {
// return "0";
// }
// return last.id;
// }, [folderChain]);
const openFolder = useCallback((path: string) => {
(async () => {
const result = await cli.sourceList({ path }).response;
console.log("source list", {
path,
result,
converted: convertSourceFiles(result.children),
});
setFiles(convertSourceFiles(result.children));
setFolderChan(convertSourceFiles(result.chain));
})();
}, []);
useEffect(() => openFolder(""), []);
const onFileAction = useCallback(
(data: ChonkyFileActionData) => {
// console.log(data);
switch (data.id) {
case ChonkyActions.OpenFiles.id:
(async () => {
const { targetFile, files } = data.payload;
const fileToOpen = targetFile ?? files[0];
if (!fileToOpen) {
return;
}
if (fileToOpen.isDir) {
await openFolder(fileToOpen.id);
return;
}
// const file = await getFile(fileToOpen.id);
// await openDetailModel(file);
})();
return;
// case ChonkyActions.MoveFiles.id:
// (async () => {
// const { destination, files } = data.payload;
// for (const file of files) {
// await editFile(file.id, { parentid: destination.id });
// }
// await refreshAll();
// })();
// return;
// case RenameFileAction.id:
// (async () => {
// const files = data.state.selectedFilesForAction;
// if (files.length === 0) {
// return;
// }
// const file = files[0];
// const name = prompt("Provide new name for this file:", file.name);
// if (!name) {
// return;
// }
// await editFile(file.id, { name });
// await refreshAll();
// })();
// return;
// case ChonkyActions.CreateFolder.id:
// (async () => {
// const name = prompt("Provide the name for your new folder:");
// if (!name) {
// return;
// }
// await createFolder(currentID, { name });
// await refreshAll();
// })();
// return;
// case ChonkyActions.DeleteFiles.id:
// (async () => {
// const files = data.state.selectedFilesForAction;
// const fileids = files.map((file) => file.id);
// await deleteFolder(fileids);
// await refreshAll();
// })();
// return;
// case RefreshListAction.id:
// openFolder(currentID);
// return;
}
},
[openFolder]
);
const fileActions = useMemo(() => [ChonkyActions.StartDragNDrop, RefreshListAction], []);
return {
files,
folderChain,
onFileAction,
fileActions,
defaultFileViewActionId: ChonkyActions.EnableListView.id,
doubleClickDelay: 300,
};
};
const useBackupTargetBrowser = () =>
// openDetailModel: (detail: Detail) => void
{
const [files, setFiles] = useState<FileArray>(Array(1).fill(null));
const [folderChain, setFolderChan] = useState<FileArray>([Root]);
// const currentID = useMemo(() => {
// if (folderChain.length === 0) {
// return "0";
// }
// const last = folderChain.slice(-1)[0];
// if (!last) {
// return "0";
// }
// return last.id;
// }, [folderChain]);
const openFolder = useCallback((path: string) => {
(async () => {
const result = await cli.sourceList({ path }).response;
result.chain[0].name = "BackupSource";
setFiles(convertSourceFiles(result.children));
setFolderChan(convertSourceFiles(result.chain));
})();
}, []);
useEffect(() => openFolder(""), []);
const onFileAction = useCallback(
(data: ChonkyFileActionData) => {
// console.log(data);
switch (data.id) {
case ChonkyActions.OpenFiles.id:
(async () => {
const { targetFile, files } = data.payload;
const fileToOpen = targetFile ?? files[0];
if (!fileToOpen) {
return;
}
if (fileToOpen.isDir) {
await openFolder(fileToOpen.id);
return;
}
// const file = await getFile(fileToOpen.id);
// await openDetailModel(file);
})();
return;
// case ChonkyActions.MoveFiles.id:
// (async () => {
// const { destination, files } = data.payload;
// for (const file of files) {
// await editFile(file.id, { parentid: destination.id });
// }
// await refreshAll();
// })();
// return;
// case RenameFileAction.id:
// (async () => {
// const files = data.state.selectedFilesForAction;
// if (files.length === 0) {
// return;
// }
// const file = files[0];
// const name = prompt("Provide new name for this file:", file.name);
// if (!name) {
// return;
// }
// await editFile(file.id, { name });
// await refreshAll();
// })();
// return;
// case ChonkyActions.CreateFolder.id:
// (async () => {
// const name = prompt("Provide the name for your new folder:");
// if (!name) {
// return;
// }
// await createFolder(currentID, { name });
// await refreshAll();
// })();
// return;
// case ChonkyActions.DeleteFiles.id:
// (async () => {
// const files = data.state.selectedFilesForAction;
// const fileids = files.map((file) => file.id);
// await deleteFolder(fileids);
// await refreshAll();
// })();
// return;
// case RefreshListAction.id:
// openFolder(currentID);
// return;
}
},
[openFolder]
);
const fileActions = useMemo(() => [ChonkyActions.StartDragNDrop, RefreshListAction], []);
return {
files,
folderChain,
onFileAction,
fileActions,
defaultFileViewActionId: ChonkyActions.EnableListView.id,
doubleClickDelay: 300,
};
};
// const CustomDropZone = () => {
// const [maybeImpostor, setMaybeImpostor] = useState<string | null>(null);
// const [{ isOver, canDrop }, drop] = useDrop({
// accept: ChonkyDndFileEntryType,
// drop: (item: ChonkyDndFileEntryItem) => {
// setMaybeImpostor(item.payload.draggedFile.name);
// console.log("DnD payload:", item.payload);
// },
// // canDrop: (item: ChonkyDndFileEntryItem) => !item.payload.draggedFile.isDir,
// canDrop: (item: ChonkyDndFileEntryItem) => true,
// collect: (monitor) => ({
// isOver: monitor.isOver(),
// canDrop: monitor.canDrop(),
// }),
// });
// return (
// <div
// ref={drop}
// style={{
// boxShadow: "inset rgba(0, 0, 0, 0.6) 0 100px 0",
// backgroundImage: "url(./shadow-realm.gif)",
// lineHeight: "100px",
// textAlign: "center",
// fontSize: "1.4em",
// marginBottom: 20,
// borderRadius: 4,
// color: "#fff",
// height: 100,
// }}
// >
// {isOver
// ? canDrop
// ? "C'mon, drop 'em!"
// : "Folders are not allowed!"
// : maybeImpostor
// ? `${maybeImpostor} was not the impostor.`
// : "Drag & drop a (Chonky) file here"}
// </div>
// );
// };
export const BackupType = "backup";
export const BackupBrowser = () => {
const sourceProps = useBackupSourceBrowser();
const targetProps = useBackupTargetBrowser();
return (
<Box className="browser-box">
<Grid className="browser-container" container>
<Grid className="browser" item xs={6}>
{/* <CustomDropZone /> */}
<FullFileBrowser {...sourceProps} />
</Grid>
<Grid className="browser" item xs={6}>
<FileBrowser {...targetProps}>
<FileNavbar />
<FileToolbar />
<FileList />
<FileContextMenu />
</FileBrowser>
</Grid>
</Grid>
</Box>
);
};
+12 -12
View File
@@ -6,29 +6,29 @@
*/
export enum CopyStatus {
/**
* @generated from protobuf enum value: Draft = 0;
* @generated from protobuf enum value: DRAFT = 0;
*/
Draft = 0,
DRAFT = 0,
/**
* waiting in queue
*
* @generated from protobuf enum value: Pending = 1;
* @generated from protobuf enum value: PENDING = 1;
*/
Pending = 1,
PENDING = 1,
/**
* @generated from protobuf enum value: Running = 2;
* @generated from protobuf enum value: RUNNING = 2;
*/
Running = 2,
RUNNING = 2,
/**
* @generated from protobuf enum value: Staged = 3;
* @generated from protobuf enum value: STAGED = 3;
*/
Staged = 3,
STAGED = 3,
/**
* @generated from protobuf enum value: Submited = 4;
* @generated from protobuf enum value: SUBMITED = 4;
*/
Submited = 4,
SUBMITED = 4,
/**
* @generated from protobuf enum value: Failed = 255;
* @generated from protobuf enum value: FAILED = 255;
*/
Failed = 255
FAILED = 255
}
+1
View File
@@ -4,6 +4,7 @@ export * from "./file";
export * from "./job";
export * from "./job_archive";
export * from "./job_restore";
export * from "./library_entity_type";
export * from "./position";
export * from "./service.client";
export * from "./service";
+105 -37
View File
@@ -11,10 +11,14 @@ import type { PartialMessage } from "@protobuf-ts/runtime";
import { reflectionMergePartial } from "@protobuf-ts/runtime";
import { MESSAGE_TYPE } from "@protobuf-ts/runtime";
import { MessageType } from "@protobuf-ts/runtime";
import { JobDisplayArchive } from "./job_archive";
import { JobRestoreDisplay } from "./job_restore";
import { JobArchiveDisplay } from "./job_archive";
import { JobRestoreNextParam } from "./job_restore";
import { JobArchiveNextParam } from "./job_archive";
import { JobStateArchive } from "./job_archive";
import { JobParamArchive } from "./job_archive";
import { JobRestoreState } from "./job_restore";
import { JobArchiveState } from "./job_archive";
import { JobRestoreParam } from "./job_restore";
import { JobArchiveParam } from "./job_archive";
/**
* @generated from protobuf message job.Job
*/
@@ -54,9 +58,15 @@ export interface JobParam {
param: {
oneofKind: "archive";
/**
* @generated from protobuf field: job_archive.JobParamArchive Archive = 1 [json_name = "Archive"];
* @generated from protobuf field: job_archive.JobArchiveParam archive = 1;
*/
archive: JobParamArchive;
archive: JobArchiveParam;
} | {
oneofKind: "restore";
/**
* @generated from protobuf field: job_restore.JobRestoreParam restore = 2;
*/
restore: JobRestoreParam;
} | {
oneofKind: undefined;
};
@@ -71,9 +81,15 @@ export interface JobState {
state: {
oneofKind: "archive";
/**
* @generated from protobuf field: job_archive.JobStateArchive Archive = 1 [json_name = "Archive"];
* @generated from protobuf field: job_archive.JobArchiveState archive = 1;
*/
archive: JobStateArchive;
archive: JobArchiveState;
} | {
oneofKind: "restore";
/**
* @generated from protobuf field: job_restore.JobRestoreState restore = 2;
*/
restore: JobRestoreState;
} | {
oneofKind: undefined;
};
@@ -91,6 +107,12 @@ export interface JobNextParam {
* @generated from protobuf field: job_archive.JobArchiveNextParam archive = 1;
*/
archive: JobArchiveNextParam;
} | {
oneofKind: "restore";
/**
* @generated from protobuf field: job_restore.JobRestoreNextParam restore = 2;
*/
restore: JobRestoreNextParam;
} | {
oneofKind: undefined;
};
@@ -135,9 +157,15 @@ export interface JobDisplay {
display: {
oneofKind: "archive";
/**
* @generated from protobuf field: job_archive.JobDisplayArchive archive = 1;
* @generated from protobuf field: job_archive.JobArchiveDisplay archive = 1;
*/
archive: JobDisplayArchive;
archive: JobArchiveDisplay;
} | {
oneofKind: "restore";
/**
* @generated from protobuf field: job_restore.JobRestoreDisplay restore = 2;
*/
restore: JobRestoreDisplay;
} | {
oneofKind: undefined;
};
@@ -147,33 +175,33 @@ export interface JobDisplay {
*/
export enum JobStatus {
/**
* @generated from protobuf enum value: Draft = 0;
* @generated from protobuf enum value: DRAFT = 0;
*/
Draft = 0,
DRAFT = 0,
/**
* dependencies not satisfied
*
* @generated from protobuf enum value: NotReady = 1;
* @generated from protobuf enum value: NOT_READY = 1;
*/
NotReady = 1,
NOT_READY = 1,
/**
* waiting in queue
*
* @generated from protobuf enum value: Pending = 2;
* @generated from protobuf enum value: PENDING = 2;
*/
Pending = 2,
PENDING = 2,
/**
* @generated from protobuf enum value: Processing = 3;
* @generated from protobuf enum value: PROCESSING = 3;
*/
Processing = 3,
PROCESSING = 3,
/**
* @generated from protobuf enum value: Completed = 4;
* @generated from protobuf enum value: COMPLETED = 4;
*/
Completed = 4,
COMPLETED = 4,
/**
* @generated from protobuf enum value: Failed = 255;
* @generated from protobuf enum value: FAILED = 255;
*/
Failed = 255
FAILED = 255
}
// @generated message type with reflection information, may provide speed optimized methods
class Job$Type extends MessageType<Job> {
@@ -261,7 +289,8 @@ export const Job = new Job$Type();
class JobParam$Type extends MessageType<JobParam> {
constructor() {
super("job.JobParam", [
{ no: 1, name: "Archive", kind: "message", jsonName: "Archive", oneof: "param", T: () => JobParamArchive }
{ no: 1, name: "archive", kind: "message", oneof: "param", T: () => JobArchiveParam },
{ no: 2, name: "restore", kind: "message", oneof: "param", T: () => JobRestoreParam }
]);
}
create(value?: PartialMessage<JobParam>): JobParam {
@@ -276,10 +305,16 @@ class JobParam$Type extends MessageType<JobParam> {
while (reader.pos < end) {
let [fieldNo, wireType] = reader.tag();
switch (fieldNo) {
case /* job_archive.JobParamArchive Archive = 1 [json_name = "Archive"];*/ 1:
case /* job_archive.JobArchiveParam archive */ 1:
message.param = {
oneofKind: "archive",
archive: JobParamArchive.internalBinaryRead(reader, reader.uint32(), options, (message.param as any).archive)
archive: JobArchiveParam.internalBinaryRead(reader, reader.uint32(), options, (message.param as any).archive)
};
break;
case /* job_restore.JobRestoreParam restore */ 2:
message.param = {
oneofKind: "restore",
restore: JobRestoreParam.internalBinaryRead(reader, reader.uint32(), options, (message.param as any).restore)
};
break;
default:
@@ -294,9 +329,12 @@ class JobParam$Type extends MessageType<JobParam> {
return message;
}
internalBinaryWrite(message: JobParam, writer: IBinaryWriter, options: BinaryWriteOptions): IBinaryWriter {
/* job_archive.JobParamArchive Archive = 1 [json_name = "Archive"]; */
/* job_archive.JobArchiveParam archive = 1; */
if (message.param.oneofKind === "archive")
JobParamArchive.internalBinaryWrite(message.param.archive, writer.tag(1, WireType.LengthDelimited).fork(), options).join();
JobArchiveParam.internalBinaryWrite(message.param.archive, writer.tag(1, WireType.LengthDelimited).fork(), options).join();
/* job_restore.JobRestoreParam restore = 2; */
if (message.param.oneofKind === "restore")
JobRestoreParam.internalBinaryWrite(message.param.restore, writer.tag(2, WireType.LengthDelimited).fork(), options).join();
let u = options.writeUnknownFields;
if (u !== false)
(u == true ? UnknownFieldHandler.onWrite : u)(this.typeName, message, writer);
@@ -311,7 +349,8 @@ export const JobParam = new JobParam$Type();
class JobState$Type extends MessageType<JobState> {
constructor() {
super("job.JobState", [
{ no: 1, name: "Archive", kind: "message", jsonName: "Archive", oneof: "state", T: () => JobStateArchive }
{ no: 1, name: "archive", kind: "message", oneof: "state", T: () => JobArchiveState },
{ no: 2, name: "restore", kind: "message", oneof: "state", T: () => JobRestoreState }
]);
}
create(value?: PartialMessage<JobState>): JobState {
@@ -326,10 +365,16 @@ class JobState$Type extends MessageType<JobState> {
while (reader.pos < end) {
let [fieldNo, wireType] = reader.tag();
switch (fieldNo) {
case /* job_archive.JobStateArchive Archive = 1 [json_name = "Archive"];*/ 1:
case /* job_archive.JobArchiveState archive */ 1:
message.state = {
oneofKind: "archive",
archive: JobStateArchive.internalBinaryRead(reader, reader.uint32(), options, (message.state as any).archive)
archive: JobArchiveState.internalBinaryRead(reader, reader.uint32(), options, (message.state as any).archive)
};
break;
case /* job_restore.JobRestoreState restore */ 2:
message.state = {
oneofKind: "restore",
restore: JobRestoreState.internalBinaryRead(reader, reader.uint32(), options, (message.state as any).restore)
};
break;
default:
@@ -344,9 +389,12 @@ class JobState$Type extends MessageType<JobState> {
return message;
}
internalBinaryWrite(message: JobState, writer: IBinaryWriter, options: BinaryWriteOptions): IBinaryWriter {
/* job_archive.JobStateArchive Archive = 1 [json_name = "Archive"]; */
/* job_archive.JobArchiveState archive = 1; */
if (message.state.oneofKind === "archive")
JobStateArchive.internalBinaryWrite(message.state.archive, writer.tag(1, WireType.LengthDelimited).fork(), options).join();
JobArchiveState.internalBinaryWrite(message.state.archive, writer.tag(1, WireType.LengthDelimited).fork(), options).join();
/* job_restore.JobRestoreState restore = 2; */
if (message.state.oneofKind === "restore")
JobRestoreState.internalBinaryWrite(message.state.restore, writer.tag(2, WireType.LengthDelimited).fork(), options).join();
let u = options.writeUnknownFields;
if (u !== false)
(u == true ? UnknownFieldHandler.onWrite : u)(this.typeName, message, writer);
@@ -361,7 +409,8 @@ export const JobState = new JobState$Type();
class JobNextParam$Type extends MessageType<JobNextParam> {
constructor() {
super("job.JobNextParam", [
{ no: 1, name: "archive", kind: "message", oneof: "param", T: () => JobArchiveNextParam }
{ no: 1, name: "archive", kind: "message", oneof: "param", T: () => JobArchiveNextParam },
{ no: 2, name: "restore", kind: "message", oneof: "param", T: () => JobRestoreNextParam }
]);
}
create(value?: PartialMessage<JobNextParam>): JobNextParam {
@@ -382,6 +431,12 @@ class JobNextParam$Type extends MessageType<JobNextParam> {
archive: JobArchiveNextParam.internalBinaryRead(reader, reader.uint32(), options, (message.param as any).archive)
};
break;
case /* job_restore.JobRestoreNextParam restore */ 2:
message.param = {
oneofKind: "restore",
restore: JobRestoreNextParam.internalBinaryRead(reader, reader.uint32(), options, (message.param as any).restore)
};
break;
default:
let u = options.readUnknownField;
if (u === "throw")
@@ -397,6 +452,9 @@ class JobNextParam$Type extends MessageType<JobNextParam> {
/* job_archive.JobArchiveNextParam archive = 1; */
if (message.param.oneofKind === "archive")
JobArchiveNextParam.internalBinaryWrite(message.param.archive, writer.tag(1, WireType.LengthDelimited).fork(), options).join();
/* job_restore.JobRestoreNextParam restore = 2; */
if (message.param.oneofKind === "restore")
JobRestoreNextParam.internalBinaryWrite(message.param.restore, writer.tag(2, WireType.LengthDelimited).fork(), options).join();
let u = options.writeUnknownFields;
if (u !== false)
(u == true ? UnknownFieldHandler.onWrite : u)(this.typeName, message, writer);
@@ -526,7 +584,8 @@ export const JobFilter = new JobFilter$Type();
class JobDisplay$Type extends MessageType<JobDisplay> {
constructor() {
super("job.JobDisplay", [
{ no: 1, name: "archive", kind: "message", oneof: "display", T: () => JobDisplayArchive }
{ no: 1, name: "archive", kind: "message", oneof: "display", T: () => JobArchiveDisplay },
{ no: 2, name: "restore", kind: "message", oneof: "display", T: () => JobRestoreDisplay }
]);
}
create(value?: PartialMessage<JobDisplay>): JobDisplay {
@@ -541,10 +600,16 @@ class JobDisplay$Type extends MessageType<JobDisplay> {
while (reader.pos < end) {
let [fieldNo, wireType] = reader.tag();
switch (fieldNo) {
case /* job_archive.JobDisplayArchive archive */ 1:
case /* job_archive.JobArchiveDisplay archive */ 1:
message.display = {
oneofKind: "archive",
archive: JobDisplayArchive.internalBinaryRead(reader, reader.uint32(), options, (message.display as any).archive)
archive: JobArchiveDisplay.internalBinaryRead(reader, reader.uint32(), options, (message.display as any).archive)
};
break;
case /* job_restore.JobRestoreDisplay restore */ 2:
message.display = {
oneofKind: "restore",
restore: JobRestoreDisplay.internalBinaryRead(reader, reader.uint32(), options, (message.display as any).restore)
};
break;
default:
@@ -559,9 +624,12 @@ class JobDisplay$Type extends MessageType<JobDisplay> {
return message;
}
internalBinaryWrite(message: JobDisplay, writer: IBinaryWriter, options: BinaryWriteOptions): IBinaryWriter {
/* job_archive.JobDisplayArchive archive = 1; */
/* job_archive.JobArchiveDisplay archive = 1; */
if (message.display.oneofKind === "archive")
JobDisplayArchive.internalBinaryWrite(message.display.archive, writer.tag(1, WireType.LengthDelimited).fork(), options).join();
JobArchiveDisplay.internalBinaryWrite(message.display.archive, writer.tag(1, WireType.LengthDelimited).fork(), options).join();
/* job_restore.JobRestoreDisplay restore = 2; */
if (message.display.oneofKind === "restore")
JobRestoreDisplay.internalBinaryWrite(message.display.restore, writer.tag(2, WireType.LengthDelimited).fork(), options).join();
let u = options.writeUnknownFields;
if (u !== false)
(u == true ? UnknownFieldHandler.onWrite : u)(this.typeName, message, writer);
+70 -70
View File
@@ -14,9 +14,9 @@ import { MessageType } from "@protobuf-ts/runtime";
import { SourceState } from "./source";
import { Source } from "./source";
/**
* @generated from protobuf message job_archive.JobParamArchive
* @generated from protobuf message job_archive.JobArchiveParam
*/
export interface JobParamArchive {
export interface JobArchiveParam {
/**
* @generated from protobuf field: repeated source.Source sources = 1;
*/
@@ -32,19 +32,19 @@ export interface JobArchiveNextParam {
param: {
oneofKind: "waitForTape";
/**
* @generated from protobuf field: job_archive.JobArchiveWaitForTapeParam WaitForTape = 1 [json_name = "WaitForTape"];
* @generated from protobuf field: job_archive.JobArchiveWaitForTapeParam wait_for_tape = 1;
*/
waitForTape: JobArchiveWaitForTapeParam;
} | {
oneofKind: "copying";
/**
* @generated from protobuf field: job_archive.JobArchiveCopyingParam Copying = 2 [json_name = "Copying"];
* @generated from protobuf field: job_archive.JobArchiveCopyingParam copying = 2;
*/
copying: JobArchiveCopyingParam;
} | {
oneofKind: "finished";
/**
* @generated from protobuf field: job_archive.JobArchiveFinishedParam Finished = 255 [json_name = "Finished"];
* @generated from protobuf field: job_archive.JobArchiveFinishedParam finished = 255;
*/
finished: JobArchiveFinishedParam;
} | {
@@ -79,9 +79,9 @@ export interface JobArchiveCopyingParam {
export interface JobArchiveFinishedParam {
}
/**
* @generated from protobuf message job_archive.JobStateArchive
* @generated from protobuf message job_archive.JobArchiveState
*/
export interface JobStateArchive {
export interface JobArchiveState {
/**
* @generated from protobuf field: job_archive.JobArchiveStep step = 1;
*/
@@ -92,23 +92,23 @@ export interface JobStateArchive {
sources: SourceState[];
}
/**
* @generated from protobuf message job_archive.JobDisplayArchive
* @generated from protobuf message job_archive.JobArchiveDisplay
*/
export interface JobDisplayArchive {
export interface JobArchiveDisplay {
/**
* @generated from protobuf field: int64 copyedBytes = 1;
* @generated from protobuf field: int64 copyed_bytes = 1;
*/
copyedBytes: bigint;
/**
* @generated from protobuf field: int64 copyedFiles = 2;
* @generated from protobuf field: int64 copyed_files = 2;
*/
copyedFiles: bigint;
/**
* @generated from protobuf field: int64 totalBytes = 3;
* @generated from protobuf field: int64 total_bytes = 3;
*/
totalBytes: bigint;
/**
* @generated from protobuf field: int64 totalFiles = 4;
* @generated from protobuf field: int64 total_files = 4;
*/
totalFiles: bigint;
/**
@@ -116,7 +116,7 @@ export interface JobDisplayArchive {
*/
speed?: bigint;
/**
* @generated from protobuf field: int64 startTime = 6;
* @generated from protobuf field: int64 start_time = 6;
*/
startTime: bigint;
}
@@ -125,37 +125,37 @@ export interface JobDisplayArchive {
*/
export enum JobArchiveStep {
/**
* @generated from protobuf enum value: Pending = 0;
* @generated from protobuf enum value: PENDING = 0;
*/
Pending = 0,
PENDING = 0,
/**
* @generated from protobuf enum value: WaitForTape = 1;
* @generated from protobuf enum value: WAIT_FOR_TAPE = 1;
*/
WaitForTape = 1,
WAIT_FOR_TAPE = 1,
/**
* @generated from protobuf enum value: Copying = 2;
* @generated from protobuf enum value: COPYING = 2;
*/
Copying = 2,
COPYING = 2,
/**
* @generated from protobuf enum value: Finished = 255;
* @generated from protobuf enum value: FINISHED = 255;
*/
Finished = 255
FINISHED = 255
}
// @generated message type with reflection information, may provide speed optimized methods
class JobParamArchive$Type extends MessageType<JobParamArchive> {
class JobArchiveParam$Type extends MessageType<JobArchiveParam> {
constructor() {
super("job_archive.JobParamArchive", [
super("job_archive.JobArchiveParam", [
{ no: 1, name: "sources", kind: "message", repeat: 1 /*RepeatType.PACKED*/, T: () => Source }
]);
}
create(value?: PartialMessage<JobParamArchive>): JobParamArchive {
create(value?: PartialMessage<JobArchiveParam>): JobArchiveParam {
const message = { sources: [] };
globalThis.Object.defineProperty(message, MESSAGE_TYPE, { enumerable: false, value: this });
if (value !== undefined)
reflectionMergePartial<JobParamArchive>(this, message, value);
reflectionMergePartial<JobArchiveParam>(this, message, value);
return message;
}
internalBinaryRead(reader: IBinaryReader, length: number, options: BinaryReadOptions, target?: JobParamArchive): JobParamArchive {
internalBinaryRead(reader: IBinaryReader, length: number, options: BinaryReadOptions, target?: JobArchiveParam): JobArchiveParam {
let message = target ?? this.create(), end = reader.pos + length;
while (reader.pos < end) {
let [fieldNo, wireType] = reader.tag();
@@ -174,7 +174,7 @@ class JobParamArchive$Type extends MessageType<JobParamArchive> {
}
return message;
}
internalBinaryWrite(message: JobParamArchive, writer: IBinaryWriter, options: BinaryWriteOptions): IBinaryWriter {
internalBinaryWrite(message: JobArchiveParam, writer: IBinaryWriter, options: BinaryWriteOptions): IBinaryWriter {
/* repeated source.Source sources = 1; */
for (let i = 0; i < message.sources.length; i++)
Source.internalBinaryWrite(message.sources[i], writer.tag(1, WireType.LengthDelimited).fork(), options).join();
@@ -185,16 +185,16 @@ class JobParamArchive$Type extends MessageType<JobParamArchive> {
}
}
/**
* @generated MessageType for protobuf message job_archive.JobParamArchive
* @generated MessageType for protobuf message job_archive.JobArchiveParam
*/
export const JobParamArchive = new JobParamArchive$Type();
export const JobArchiveParam = new JobArchiveParam$Type();
// @generated message type with reflection information, may provide speed optimized methods
class JobArchiveNextParam$Type extends MessageType<JobArchiveNextParam> {
constructor() {
super("job_archive.JobArchiveNextParam", [
{ no: 1, name: "WaitForTape", kind: "message", jsonName: "WaitForTape", oneof: "param", T: () => JobArchiveWaitForTapeParam },
{ no: 2, name: "Copying", kind: "message", jsonName: "Copying", oneof: "param", T: () => JobArchiveCopyingParam },
{ no: 255, name: "Finished", kind: "message", jsonName: "Finished", oneof: "param", T: () => JobArchiveFinishedParam }
{ no: 1, name: "wait_for_tape", kind: "message", oneof: "param", T: () => JobArchiveWaitForTapeParam },
{ no: 2, name: "copying", kind: "message", oneof: "param", T: () => JobArchiveCopyingParam },
{ no: 255, name: "finished", kind: "message", oneof: "param", T: () => JobArchiveFinishedParam }
]);
}
create(value?: PartialMessage<JobArchiveNextParam>): JobArchiveNextParam {
@@ -209,19 +209,19 @@ class JobArchiveNextParam$Type extends MessageType<JobArchiveNextParam> {
while (reader.pos < end) {
let [fieldNo, wireType] = reader.tag();
switch (fieldNo) {
case /* job_archive.JobArchiveWaitForTapeParam WaitForTape = 1 [json_name = "WaitForTape"];*/ 1:
case /* job_archive.JobArchiveWaitForTapeParam wait_for_tape */ 1:
message.param = {
oneofKind: "waitForTape",
waitForTape: JobArchiveWaitForTapeParam.internalBinaryRead(reader, reader.uint32(), options, (message.param as any).waitForTape)
};
break;
case /* job_archive.JobArchiveCopyingParam Copying = 2 [json_name = "Copying"];*/ 2:
case /* job_archive.JobArchiveCopyingParam copying */ 2:
message.param = {
oneofKind: "copying",
copying: JobArchiveCopyingParam.internalBinaryRead(reader, reader.uint32(), options, (message.param as any).copying)
};
break;
case /* job_archive.JobArchiveFinishedParam Finished = 255 [json_name = "Finished"];*/ 255:
case /* job_archive.JobArchiveFinishedParam finished */ 255:
message.param = {
oneofKind: "finished",
finished: JobArchiveFinishedParam.internalBinaryRead(reader, reader.uint32(), options, (message.param as any).finished)
@@ -239,13 +239,13 @@ class JobArchiveNextParam$Type extends MessageType<JobArchiveNextParam> {
return message;
}
internalBinaryWrite(message: JobArchiveNextParam, writer: IBinaryWriter, options: BinaryWriteOptions): IBinaryWriter {
/* job_archive.JobArchiveWaitForTapeParam WaitForTape = 1 [json_name = "WaitForTape"]; */
/* job_archive.JobArchiveWaitForTapeParam wait_for_tape = 1; */
if (message.param.oneofKind === "waitForTape")
JobArchiveWaitForTapeParam.internalBinaryWrite(message.param.waitForTape, writer.tag(1, WireType.LengthDelimited).fork(), options).join();
/* job_archive.JobArchiveCopyingParam Copying = 2 [json_name = "Copying"]; */
/* job_archive.JobArchiveCopyingParam copying = 2; */
if (message.param.oneofKind === "copying")
JobArchiveCopyingParam.internalBinaryWrite(message.param.copying, writer.tag(2, WireType.LengthDelimited).fork(), options).join();
/* job_archive.JobArchiveFinishedParam Finished = 255 [json_name = "Finished"]; */
/* job_archive.JobArchiveFinishedParam finished = 255; */
if (message.param.oneofKind === "finished")
JobArchiveFinishedParam.internalBinaryWrite(message.param.finished, writer.tag(255, WireType.LengthDelimited).fork(), options).join();
let u = options.writeUnknownFields;
@@ -372,21 +372,21 @@ class JobArchiveFinishedParam$Type extends MessageType<JobArchiveFinishedParam>
*/
export const JobArchiveFinishedParam = new JobArchiveFinishedParam$Type();
// @generated message type with reflection information, may provide speed optimized methods
class JobStateArchive$Type extends MessageType<JobStateArchive> {
class JobArchiveState$Type extends MessageType<JobArchiveState> {
constructor() {
super("job_archive.JobStateArchive", [
super("job_archive.JobArchiveState", [
{ no: 1, name: "step", kind: "enum", T: () => ["job_archive.JobArchiveStep", JobArchiveStep] },
{ no: 2, name: "sources", kind: "message", repeat: 1 /*RepeatType.PACKED*/, T: () => SourceState }
]);
}
create(value?: PartialMessage<JobStateArchive>): JobStateArchive {
create(value?: PartialMessage<JobArchiveState>): JobArchiveState {
const message = { step: 0, sources: [] };
globalThis.Object.defineProperty(message, MESSAGE_TYPE, { enumerable: false, value: this });
if (value !== undefined)
reflectionMergePartial<JobStateArchive>(this, message, value);
reflectionMergePartial<JobArchiveState>(this, message, value);
return message;
}
internalBinaryRead(reader: IBinaryReader, length: number, options: BinaryReadOptions, target?: JobStateArchive): JobStateArchive {
internalBinaryRead(reader: IBinaryReader, length: number, options: BinaryReadOptions, target?: JobArchiveState): JobArchiveState {
let message = target ?? this.create(), end = reader.pos + length;
while (reader.pos < end) {
let [fieldNo, wireType] = reader.tag();
@@ -408,7 +408,7 @@ class JobStateArchive$Type extends MessageType<JobStateArchive> {
}
return message;
}
internalBinaryWrite(message: JobStateArchive, writer: IBinaryWriter, options: BinaryWriteOptions): IBinaryWriter {
internalBinaryWrite(message: JobArchiveState, writer: IBinaryWriter, options: BinaryWriteOptions): IBinaryWriter {
/* job_archive.JobArchiveStep step = 1; */
if (message.step !== 0)
writer.tag(1, WireType.Varint).int32(message.step);
@@ -422,49 +422,49 @@ class JobStateArchive$Type extends MessageType<JobStateArchive> {
}
}
/**
* @generated MessageType for protobuf message job_archive.JobStateArchive
* @generated MessageType for protobuf message job_archive.JobArchiveState
*/
export const JobStateArchive = new JobStateArchive$Type();
export const JobArchiveState = new JobArchiveState$Type();
// @generated message type with reflection information, may provide speed optimized methods
class JobDisplayArchive$Type extends MessageType<JobDisplayArchive> {
class JobArchiveDisplay$Type extends MessageType<JobArchiveDisplay> {
constructor() {
super("job_archive.JobDisplayArchive", [
{ no: 1, name: "copyedBytes", kind: "scalar", T: 3 /*ScalarType.INT64*/, L: 0 /*LongType.BIGINT*/ },
{ no: 2, name: "copyedFiles", kind: "scalar", T: 3 /*ScalarType.INT64*/, L: 0 /*LongType.BIGINT*/ },
{ no: 3, name: "totalBytes", kind: "scalar", T: 3 /*ScalarType.INT64*/, L: 0 /*LongType.BIGINT*/ },
{ no: 4, name: "totalFiles", kind: "scalar", T: 3 /*ScalarType.INT64*/, L: 0 /*LongType.BIGINT*/ },
super("job_archive.JobArchiveDisplay", [
{ no: 1, name: "copyed_bytes", kind: "scalar", T: 3 /*ScalarType.INT64*/, L: 0 /*LongType.BIGINT*/ },
{ no: 2, name: "copyed_files", kind: "scalar", T: 3 /*ScalarType.INT64*/, L: 0 /*LongType.BIGINT*/ },
{ no: 3, name: "total_bytes", kind: "scalar", T: 3 /*ScalarType.INT64*/, L: 0 /*LongType.BIGINT*/ },
{ no: 4, name: "total_files", kind: "scalar", T: 3 /*ScalarType.INT64*/, L: 0 /*LongType.BIGINT*/ },
{ no: 5, name: "speed", kind: "scalar", opt: true, T: 3 /*ScalarType.INT64*/, L: 0 /*LongType.BIGINT*/ },
{ no: 6, name: "startTime", kind: "scalar", T: 3 /*ScalarType.INT64*/, L: 0 /*LongType.BIGINT*/ }
{ no: 6, name: "start_time", kind: "scalar", T: 3 /*ScalarType.INT64*/, L: 0 /*LongType.BIGINT*/ }
]);
}
create(value?: PartialMessage<JobDisplayArchive>): JobDisplayArchive {
create(value?: PartialMessage<JobArchiveDisplay>): JobArchiveDisplay {
const message = { copyedBytes: 0n, copyedFiles: 0n, totalBytes: 0n, totalFiles: 0n, startTime: 0n };
globalThis.Object.defineProperty(message, MESSAGE_TYPE, { enumerable: false, value: this });
if (value !== undefined)
reflectionMergePartial<JobDisplayArchive>(this, message, value);
reflectionMergePartial<JobArchiveDisplay>(this, message, value);
return message;
}
internalBinaryRead(reader: IBinaryReader, length: number, options: BinaryReadOptions, target?: JobDisplayArchive): JobDisplayArchive {
internalBinaryRead(reader: IBinaryReader, length: number, options: BinaryReadOptions, target?: JobArchiveDisplay): JobArchiveDisplay {
let message = target ?? this.create(), end = reader.pos + length;
while (reader.pos < end) {
let [fieldNo, wireType] = reader.tag();
switch (fieldNo) {
case /* int64 copyedBytes */ 1:
case /* int64 copyed_bytes */ 1:
message.copyedBytes = reader.int64().toBigInt();
break;
case /* int64 copyedFiles */ 2:
case /* int64 copyed_files */ 2:
message.copyedFiles = reader.int64().toBigInt();
break;
case /* int64 totalBytes */ 3:
case /* int64 total_bytes */ 3:
message.totalBytes = reader.int64().toBigInt();
break;
case /* int64 totalFiles */ 4:
case /* int64 total_files */ 4:
message.totalFiles = reader.int64().toBigInt();
break;
case /* optional int64 speed */ 5:
message.speed = reader.int64().toBigInt();
break;
case /* int64 startTime */ 6:
case /* int64 start_time */ 6:
message.startTime = reader.int64().toBigInt();
break;
default:
@@ -478,23 +478,23 @@ class JobDisplayArchive$Type extends MessageType<JobDisplayArchive> {
}
return message;
}
internalBinaryWrite(message: JobDisplayArchive, writer: IBinaryWriter, options: BinaryWriteOptions): IBinaryWriter {
/* int64 copyedBytes = 1; */
internalBinaryWrite(message: JobArchiveDisplay, writer: IBinaryWriter, options: BinaryWriteOptions): IBinaryWriter {
/* int64 copyed_bytes = 1; */
if (message.copyedBytes !== 0n)
writer.tag(1, WireType.Varint).int64(message.copyedBytes);
/* int64 copyedFiles = 2; */
/* int64 copyed_files = 2; */
if (message.copyedFiles !== 0n)
writer.tag(2, WireType.Varint).int64(message.copyedFiles);
/* int64 totalBytes = 3; */
/* int64 total_bytes = 3; */
if (message.totalBytes !== 0n)
writer.tag(3, WireType.Varint).int64(message.totalBytes);
/* int64 totalFiles = 4; */
/* int64 total_files = 4; */
if (message.totalFiles !== 0n)
writer.tag(4, WireType.Varint).int64(message.totalFiles);
/* optional int64 speed = 5; */
if (message.speed !== undefined)
writer.tag(5, WireType.Varint).int64(message.speed);
/* int64 startTime = 6; */
/* int64 start_time = 6; */
if (message.startTime !== 0n)
writer.tag(6, WireType.Varint).int64(message.startTime);
let u = options.writeUnknownFields;
@@ -504,6 +504,6 @@ class JobDisplayArchive$Type extends MessageType<JobDisplayArchive> {
}
}
/**
* @generated MessageType for protobuf message job_archive.JobDisplayArchive
* @generated MessageType for protobuf message job_archive.JobArchiveDisplay
*/
export const JobDisplayArchive = new JobDisplayArchive$Type();
export const JobArchiveDisplay = new JobArchiveDisplay$Type();
+250 -117
View File
@@ -13,9 +13,9 @@ import { MESSAGE_TYPE } from "@protobuf-ts/runtime";
import { MessageType } from "@protobuf-ts/runtime";
import { CopyStatus } from "./copy_status";
/**
* @generated from protobuf message job_restore.JobParamRestore
* @generated from protobuf message job_restore.JobRestoreParam
*/
export interface JobParamRestore {
export interface JobRestoreParam {
/**
* @generated from protobuf field: repeated int64 file_ids = 1;
*/
@@ -31,19 +31,19 @@ export interface JobRestoreNextParam {
param: {
oneofKind: "waitForTape";
/**
* @generated from protobuf field: job_restore.JobRestoreWaitForTapeParam WaitForTape = 1 [json_name = "WaitForTape"];
* @generated from protobuf field: job_restore.JobRestoreWaitForTapeParam wait_for_tape = 1;
*/
waitForTape: JobRestoreWaitForTapeParam;
} | {
oneofKind: "copying";
/**
* @generated from protobuf field: job_restore.JobRestoreCopyingParam Copying = 2 [json_name = "Copying"];
* @generated from protobuf field: job_restore.JobRestoreCopyingParam copying = 2;
*/
copying: JobRestoreCopyingParam;
} | {
oneofKind: "finished";
/**
* @generated from protobuf field: job_restore.JobRestoreFinishedParam Finished = 255 [json_name = "Finished"];
* @generated from protobuf field: job_restore.JobRestoreFinishedParam finished = 255;
*/
finished: JobRestoreFinishedParam;
} | {
@@ -70,63 +70,100 @@ export interface JobRestoreCopyingParam {
export interface JobRestoreFinishedParam {
}
/**
* @generated from protobuf message job_restore.FileRestoreState
* @generated from protobuf message job_restore.RestoreFile
*/
export interface FileRestoreState {
export interface RestoreFile {
/**
* @generated from protobuf field: int64 file_id = 1;
*/
fileId: bigint;
/**
* @generated from protobuf field: copy_status.CopyStatus status = 2;
*/
status: CopyStatus;
/**
* @generated from protobuf field: int64 tape_id = 17;
* @generated from protobuf field: int64 tape_id = 2;
*/
tapeId: bigint;
/**
* @generated from protobuf field: int64 position_id = 18;
* @generated from protobuf field: int64 position_id = 3;
*/
positionId: bigint;
/**
* @generated from protobuf field: repeated string path_in_tape = 19;
* @generated from protobuf field: copy_status.CopyStatus status = 17;
*/
pathInTape: string[];
status: CopyStatus;
/**
* @generated from protobuf field: int64 size = 18;
*/
size: bigint;
/**
* @generated from protobuf field: string tape_path = 33;
*/
tapePath: string;
/**
* @generated from protobuf field: string target_path = 34;
*/
targetPath: string;
}
/**
* @generated from protobuf message job_restore.JobStateRestore
* @generated from protobuf message job_restore.RestoreTape
*/
export interface JobStateRestore {
export interface RestoreTape {
/**
* @generated from protobuf field: int64 tape_id = 1;
*/
tapeId: bigint;
/**
* @generated from protobuf field: string barcode = 2;
*/
barcode: string;
/**
* @generated from protobuf field: copy_status.CopyStatus status = 17;
*/
status: CopyStatus;
/**
* @generated from protobuf field: repeated job_restore.RestoreFile files = 18;
*/
files: RestoreFile[];
}
/**
* @generated from protobuf message job_restore.JobRestoreState
*/
export interface JobRestoreState {
/**
* @generated from protobuf field: job_restore.JobRestoreStep step = 1;
*/
step: JobRestoreStep;
/**
* @generated from protobuf field: repeated job_restore.FileRestoreState files = 2;
* @generated from protobuf field: repeated job_restore.RestoreTape tapes = 2;
*/
files: FileRestoreState[];
tapes: RestoreTape[];
}
/**
* @generated from protobuf message job_restore.JobDisplayRestore
* @generated from protobuf message job_restore.JobRestoreDisplay
*/
export interface JobDisplayRestore {
export interface JobRestoreDisplay {
/**
* @generated from protobuf field: int64 copyedBytes = 1;
* @generated from protobuf field: int64 copyed_bytes = 1;
*/
copyedBytes: bigint;
/**
* @generated from protobuf field: int64 copyedFiles = 2;
* @generated from protobuf field: int64 copyed_files = 2;
*/
copyedFiles: bigint;
/**
* @generated from protobuf field: int64 totalBytes = 3;
* @generated from protobuf field: int64 total_bytes = 3;
*/
totalBytes: bigint;
/**
* @generated from protobuf field: int64 totalFiles = 4;
* @generated from protobuf field: int64 total_files = 4;
*/
totalFiles: bigint;
/**
* @generated from protobuf field: optional int64 speed = 5;
*/
speed?: bigint;
/**
* @generated from protobuf field: int64 start_time = 6;
*/
startTime: bigint;
/**
* @generated from protobuf field: bytes logs = 17;
*/
@@ -137,37 +174,37 @@ export interface JobDisplayRestore {
*/
export enum JobRestoreStep {
/**
* @generated from protobuf enum value: Pending = 0;
* @generated from protobuf enum value: PENDING = 0;
*/
Pending = 0,
PENDING = 0,
/**
* @generated from protobuf enum value: WaitForTape = 1;
* @generated from protobuf enum value: WAIT_FOR_TAPE = 1;
*/
WaitForTape = 1,
WAIT_FOR_TAPE = 1,
/**
* @generated from protobuf enum value: Copying = 2;
* @generated from protobuf enum value: COPYING = 2;
*/
Copying = 2,
COPYING = 2,
/**
* @generated from protobuf enum value: Finished = 255;
* @generated from protobuf enum value: FINISHED = 255;
*/
Finished = 255
FINISHED = 255
}
// @generated message type with reflection information, may provide speed optimized methods
class JobParamRestore$Type extends MessageType<JobParamRestore> {
class JobRestoreParam$Type extends MessageType<JobRestoreParam> {
constructor() {
super("job_restore.JobParamRestore", [
super("job_restore.JobRestoreParam", [
{ no: 1, name: "file_ids", kind: "scalar", repeat: 1 /*RepeatType.PACKED*/, T: 3 /*ScalarType.INT64*/, L: 0 /*LongType.BIGINT*/ }
]);
}
create(value?: PartialMessage<JobParamRestore>): JobParamRestore {
create(value?: PartialMessage<JobRestoreParam>): JobRestoreParam {
const message = { fileIds: [] };
globalThis.Object.defineProperty(message, MESSAGE_TYPE, { enumerable: false, value: this });
if (value !== undefined)
reflectionMergePartial<JobParamRestore>(this, message, value);
reflectionMergePartial<JobRestoreParam>(this, message, value);
return message;
}
internalBinaryRead(reader: IBinaryReader, length: number, options: BinaryReadOptions, target?: JobParamRestore): JobParamRestore {
internalBinaryRead(reader: IBinaryReader, length: number, options: BinaryReadOptions, target?: JobRestoreParam): JobRestoreParam {
let message = target ?? this.create(), end = reader.pos + length;
while (reader.pos < end) {
let [fieldNo, wireType] = reader.tag();
@@ -190,7 +227,7 @@ class JobParamRestore$Type extends MessageType<JobParamRestore> {
}
return message;
}
internalBinaryWrite(message: JobParamRestore, writer: IBinaryWriter, options: BinaryWriteOptions): IBinaryWriter {
internalBinaryWrite(message: JobRestoreParam, writer: IBinaryWriter, options: BinaryWriteOptions): IBinaryWriter {
/* repeated int64 file_ids = 1; */
if (message.fileIds.length) {
writer.tag(1, WireType.LengthDelimited).fork();
@@ -205,16 +242,16 @@ class JobParamRestore$Type extends MessageType<JobParamRestore> {
}
}
/**
* @generated MessageType for protobuf message job_restore.JobParamRestore
* @generated MessageType for protobuf message job_restore.JobRestoreParam
*/
export const JobParamRestore = new JobParamRestore$Type();
export const JobRestoreParam = new JobRestoreParam$Type();
// @generated message type with reflection information, may provide speed optimized methods
class JobRestoreNextParam$Type extends MessageType<JobRestoreNextParam> {
constructor() {
super("job_restore.JobRestoreNextParam", [
{ no: 1, name: "WaitForTape", kind: "message", jsonName: "WaitForTape", oneof: "param", T: () => JobRestoreWaitForTapeParam },
{ no: 2, name: "Copying", kind: "message", jsonName: "Copying", oneof: "param", T: () => JobRestoreCopyingParam },
{ no: 255, name: "Finished", kind: "message", jsonName: "Finished", oneof: "param", T: () => JobRestoreFinishedParam }
{ no: 1, name: "wait_for_tape", kind: "message", oneof: "param", T: () => JobRestoreWaitForTapeParam },
{ no: 2, name: "copying", kind: "message", oneof: "param", T: () => JobRestoreCopyingParam },
{ no: 255, name: "finished", kind: "message", oneof: "param", T: () => JobRestoreFinishedParam }
]);
}
create(value?: PartialMessage<JobRestoreNextParam>): JobRestoreNextParam {
@@ -229,19 +266,19 @@ class JobRestoreNextParam$Type extends MessageType<JobRestoreNextParam> {
while (reader.pos < end) {
let [fieldNo, wireType] = reader.tag();
switch (fieldNo) {
case /* job_restore.JobRestoreWaitForTapeParam WaitForTape = 1 [json_name = "WaitForTape"];*/ 1:
case /* job_restore.JobRestoreWaitForTapeParam wait_for_tape */ 1:
message.param = {
oneofKind: "waitForTape",
waitForTape: JobRestoreWaitForTapeParam.internalBinaryRead(reader, reader.uint32(), options, (message.param as any).waitForTape)
};
break;
case /* job_restore.JobRestoreCopyingParam Copying = 2 [json_name = "Copying"];*/ 2:
case /* job_restore.JobRestoreCopyingParam copying */ 2:
message.param = {
oneofKind: "copying",
copying: JobRestoreCopyingParam.internalBinaryRead(reader, reader.uint32(), options, (message.param as any).copying)
};
break;
case /* job_restore.JobRestoreFinishedParam Finished = 255 [json_name = "Finished"];*/ 255:
case /* job_restore.JobRestoreFinishedParam finished */ 255:
message.param = {
oneofKind: "finished",
finished: JobRestoreFinishedParam.internalBinaryRead(reader, reader.uint32(), options, (message.param as any).finished)
@@ -259,13 +296,13 @@ class JobRestoreNextParam$Type extends MessageType<JobRestoreNextParam> {
return message;
}
internalBinaryWrite(message: JobRestoreNextParam, writer: IBinaryWriter, options: BinaryWriteOptions): IBinaryWriter {
/* job_restore.JobRestoreWaitForTapeParam WaitForTape = 1 [json_name = "WaitForTape"]; */
/* job_restore.JobRestoreWaitForTapeParam wait_for_tape = 1; */
if (message.param.oneofKind === "waitForTape")
JobRestoreWaitForTapeParam.internalBinaryWrite(message.param.waitForTape, writer.tag(1, WireType.LengthDelimited).fork(), options).join();
/* job_restore.JobRestoreCopyingParam Copying = 2 [json_name = "Copying"]; */
/* job_restore.JobRestoreCopyingParam copying = 2; */
if (message.param.oneofKind === "copying")
JobRestoreCopyingParam.internalBinaryWrite(message.param.copying, writer.tag(2, WireType.LengthDelimited).fork(), options).join();
/* job_restore.JobRestoreFinishedParam Finished = 255 [json_name = "Finished"]; */
/* job_restore.JobRestoreFinishedParam finished = 255; */
if (message.param.oneofKind === "finished")
JobRestoreFinishedParam.internalBinaryWrite(message.param.finished, writer.tag(255, WireType.LengthDelimited).fork(), options).join();
let u = options.writeUnknownFields;
@@ -378,24 +415,26 @@ class JobRestoreFinishedParam$Type extends MessageType<JobRestoreFinishedParam>
*/
export const JobRestoreFinishedParam = new JobRestoreFinishedParam$Type();
// @generated message type with reflection information, may provide speed optimized methods
class FileRestoreState$Type extends MessageType<FileRestoreState> {
class RestoreFile$Type extends MessageType<RestoreFile> {
constructor() {
super("job_restore.FileRestoreState", [
super("job_restore.RestoreFile", [
{ no: 1, name: "file_id", kind: "scalar", T: 3 /*ScalarType.INT64*/, L: 0 /*LongType.BIGINT*/ },
{ no: 2, name: "status", kind: "enum", T: () => ["copy_status.CopyStatus", CopyStatus] },
{ no: 17, name: "tape_id", kind: "scalar", T: 3 /*ScalarType.INT64*/, L: 0 /*LongType.BIGINT*/ },
{ no: 18, name: "position_id", kind: "scalar", T: 3 /*ScalarType.INT64*/, L: 0 /*LongType.BIGINT*/ },
{ no: 19, name: "path_in_tape", kind: "scalar", repeat: 2 /*RepeatType.UNPACKED*/, T: 9 /*ScalarType.STRING*/ }
{ no: 2, name: "tape_id", kind: "scalar", T: 3 /*ScalarType.INT64*/, L: 0 /*LongType.BIGINT*/ },
{ no: 3, name: "position_id", kind: "scalar", T: 3 /*ScalarType.INT64*/, L: 0 /*LongType.BIGINT*/ },
{ no: 17, name: "status", kind: "enum", T: () => ["copy_status.CopyStatus", CopyStatus] },
{ no: 18, name: "size", kind: "scalar", T: 3 /*ScalarType.INT64*/, L: 0 /*LongType.BIGINT*/ },
{ no: 33, name: "tape_path", kind: "scalar", T: 9 /*ScalarType.STRING*/ },
{ no: 34, name: "target_path", kind: "scalar", T: 9 /*ScalarType.STRING*/ }
]);
}
create(value?: PartialMessage<FileRestoreState>): FileRestoreState {
const message = { fileId: 0n, status: 0, tapeId: 0n, positionId: 0n, pathInTape: [] };
create(value?: PartialMessage<RestoreFile>): RestoreFile {
const message = { fileId: 0n, tapeId: 0n, positionId: 0n, status: 0, size: 0n, tapePath: "", targetPath: "" };
globalThis.Object.defineProperty(message, MESSAGE_TYPE, { enumerable: false, value: this });
if (value !== undefined)
reflectionMergePartial<FileRestoreState>(this, message, value);
reflectionMergePartial<RestoreFile>(this, message, value);
return message;
}
internalBinaryRead(reader: IBinaryReader, length: number, options: BinaryReadOptions, target?: FileRestoreState): FileRestoreState {
internalBinaryRead(reader: IBinaryReader, length: number, options: BinaryReadOptions, target?: RestoreFile): RestoreFile {
let message = target ?? this.create(), end = reader.pos + length;
while (reader.pos < end) {
let [fieldNo, wireType] = reader.tag();
@@ -403,17 +442,23 @@ class FileRestoreState$Type extends MessageType<FileRestoreState> {
case /* int64 file_id */ 1:
message.fileId = reader.int64().toBigInt();
break;
case /* copy_status.CopyStatus status */ 2:
message.status = reader.int32();
break;
case /* int64 tape_id */ 17:
case /* int64 tape_id */ 2:
message.tapeId = reader.int64().toBigInt();
break;
case /* int64 position_id */ 18:
case /* int64 position_id */ 3:
message.positionId = reader.int64().toBigInt();
break;
case /* repeated string path_in_tape */ 19:
message.pathInTape.push(reader.string());
case /* copy_status.CopyStatus status */ 17:
message.status = reader.int32();
break;
case /* int64 size */ 18:
message.size = reader.int64().toBigInt();
break;
case /* string tape_path */ 33:
message.tapePath = reader.string();
break;
case /* string target_path */ 34:
message.targetPath = reader.string();
break;
default:
let u = options.readUnknownField;
@@ -426,22 +471,28 @@ class FileRestoreState$Type extends MessageType<FileRestoreState> {
}
return message;
}
internalBinaryWrite(message: FileRestoreState, writer: IBinaryWriter, options: BinaryWriteOptions): IBinaryWriter {
internalBinaryWrite(message: RestoreFile, writer: IBinaryWriter, options: BinaryWriteOptions): IBinaryWriter {
/* int64 file_id = 1; */
if (message.fileId !== 0n)
writer.tag(1, WireType.Varint).int64(message.fileId);
/* copy_status.CopyStatus status = 2; */
if (message.status !== 0)
writer.tag(2, WireType.Varint).int32(message.status);
/* int64 tape_id = 17; */
/* int64 tape_id = 2; */
if (message.tapeId !== 0n)
writer.tag(17, WireType.Varint).int64(message.tapeId);
/* int64 position_id = 18; */
writer.tag(2, WireType.Varint).int64(message.tapeId);
/* int64 position_id = 3; */
if (message.positionId !== 0n)
writer.tag(18, WireType.Varint).int64(message.positionId);
/* repeated string path_in_tape = 19; */
for (let i = 0; i < message.pathInTape.length; i++)
writer.tag(19, WireType.LengthDelimited).string(message.pathInTape[i]);
writer.tag(3, WireType.Varint).int64(message.positionId);
/* copy_status.CopyStatus status = 17; */
if (message.status !== 0)
writer.tag(17, WireType.Varint).int32(message.status);
/* int64 size = 18; */
if (message.size !== 0n)
writer.tag(18, WireType.Varint).int64(message.size);
/* string tape_path = 33; */
if (message.tapePath !== "")
writer.tag(33, WireType.LengthDelimited).string(message.tapePath);
/* string target_path = 34; */
if (message.targetPath !== "")
writer.tag(34, WireType.LengthDelimited).string(message.targetPath);
let u = options.writeUnknownFields;
if (u !== false)
(u == true ? UnknownFieldHandler.onWrite : u)(this.typeName, message, writer);
@@ -449,25 +500,93 @@ class FileRestoreState$Type extends MessageType<FileRestoreState> {
}
}
/**
* @generated MessageType for protobuf message job_restore.FileRestoreState
* @generated MessageType for protobuf message job_restore.RestoreFile
*/
export const FileRestoreState = new FileRestoreState$Type();
export const RestoreFile = new RestoreFile$Type();
// @generated message type with reflection information, may provide speed optimized methods
class JobStateRestore$Type extends MessageType<JobStateRestore> {
class RestoreTape$Type extends MessageType<RestoreTape> {
constructor() {
super("job_restore.JobStateRestore", [
{ no: 1, name: "step", kind: "enum", T: () => ["job_restore.JobRestoreStep", JobRestoreStep] },
{ no: 2, name: "files", kind: "message", repeat: 1 /*RepeatType.PACKED*/, T: () => FileRestoreState }
super("job_restore.RestoreTape", [
{ no: 1, name: "tape_id", kind: "scalar", T: 3 /*ScalarType.INT64*/, L: 0 /*LongType.BIGINT*/ },
{ no: 2, name: "barcode", kind: "scalar", T: 9 /*ScalarType.STRING*/ },
{ no: 17, name: "status", kind: "enum", T: () => ["copy_status.CopyStatus", CopyStatus] },
{ no: 18, name: "files", kind: "message", repeat: 1 /*RepeatType.PACKED*/, T: () => RestoreFile }
]);
}
create(value?: PartialMessage<JobStateRestore>): JobStateRestore {
const message = { step: 0, files: [] };
create(value?: PartialMessage<RestoreTape>): RestoreTape {
const message = { tapeId: 0n, barcode: "", status: 0, files: [] };
globalThis.Object.defineProperty(message, MESSAGE_TYPE, { enumerable: false, value: this });
if (value !== undefined)
reflectionMergePartial<JobStateRestore>(this, message, value);
reflectionMergePartial<RestoreTape>(this, message, value);
return message;
}
internalBinaryRead(reader: IBinaryReader, length: number, options: BinaryReadOptions, target?: JobStateRestore): JobStateRestore {
internalBinaryRead(reader: IBinaryReader, length: number, options: BinaryReadOptions, target?: RestoreTape): RestoreTape {
let message = target ?? this.create(), end = reader.pos + length;
while (reader.pos < end) {
let [fieldNo, wireType] = reader.tag();
switch (fieldNo) {
case /* int64 tape_id */ 1:
message.tapeId = reader.int64().toBigInt();
break;
case /* string barcode */ 2:
message.barcode = reader.string();
break;
case /* copy_status.CopyStatus status */ 17:
message.status = reader.int32();
break;
case /* repeated job_restore.RestoreFile files */ 18:
message.files.push(RestoreFile.internalBinaryRead(reader, reader.uint32(), options));
break;
default:
let u = options.readUnknownField;
if (u === "throw")
throw new globalThis.Error(`Unknown field ${fieldNo} (wire type ${wireType}) for ${this.typeName}`);
let d = reader.skip(wireType);
if (u !== false)
(u === true ? UnknownFieldHandler.onRead : u)(this.typeName, message, fieldNo, wireType, d);
}
}
return message;
}
internalBinaryWrite(message: RestoreTape, writer: IBinaryWriter, options: BinaryWriteOptions): IBinaryWriter {
/* int64 tape_id = 1; */
if (message.tapeId !== 0n)
writer.tag(1, WireType.Varint).int64(message.tapeId);
/* string barcode = 2; */
if (message.barcode !== "")
writer.tag(2, WireType.LengthDelimited).string(message.barcode);
/* copy_status.CopyStatus status = 17; */
if (message.status !== 0)
writer.tag(17, WireType.Varint).int32(message.status);
/* repeated job_restore.RestoreFile files = 18; */
for (let i = 0; i < message.files.length; i++)
RestoreFile.internalBinaryWrite(message.files[i], writer.tag(18, WireType.LengthDelimited).fork(), options).join();
let u = options.writeUnknownFields;
if (u !== false)
(u == true ? UnknownFieldHandler.onWrite : u)(this.typeName, message, writer);
return writer;
}
}
/**
* @generated MessageType for protobuf message job_restore.RestoreTape
*/
export const RestoreTape = new RestoreTape$Type();
// @generated message type with reflection information, may provide speed optimized methods
class JobRestoreState$Type extends MessageType<JobRestoreState> {
constructor() {
super("job_restore.JobRestoreState", [
{ no: 1, name: "step", kind: "enum", T: () => ["job_restore.JobRestoreStep", JobRestoreStep] },
{ no: 2, name: "tapes", kind: "message", repeat: 1 /*RepeatType.PACKED*/, T: () => RestoreTape }
]);
}
create(value?: PartialMessage<JobRestoreState>): JobRestoreState {
const message = { step: 0, tapes: [] };
globalThis.Object.defineProperty(message, MESSAGE_TYPE, { enumerable: false, value: this });
if (value !== undefined)
reflectionMergePartial<JobRestoreState>(this, message, value);
return message;
}
internalBinaryRead(reader: IBinaryReader, length: number, options: BinaryReadOptions, target?: JobRestoreState): JobRestoreState {
let message = target ?? this.create(), end = reader.pos + length;
while (reader.pos < end) {
let [fieldNo, wireType] = reader.tag();
@@ -475,8 +594,8 @@ class JobStateRestore$Type extends MessageType<JobStateRestore> {
case /* job_restore.JobRestoreStep step */ 1:
message.step = reader.int32();
break;
case /* repeated job_restore.FileRestoreState files */ 2:
message.files.push(FileRestoreState.internalBinaryRead(reader, reader.uint32(), options));
case /* repeated job_restore.RestoreTape tapes */ 2:
message.tapes.push(RestoreTape.internalBinaryRead(reader, reader.uint32(), options));
break;
default:
let u = options.readUnknownField;
@@ -489,13 +608,13 @@ class JobStateRestore$Type extends MessageType<JobStateRestore> {
}
return message;
}
internalBinaryWrite(message: JobStateRestore, writer: IBinaryWriter, options: BinaryWriteOptions): IBinaryWriter {
internalBinaryWrite(message: JobRestoreState, writer: IBinaryWriter, options: BinaryWriteOptions): IBinaryWriter {
/* job_restore.JobRestoreStep step = 1; */
if (message.step !== 0)
writer.tag(1, WireType.Varint).int32(message.step);
/* repeated job_restore.FileRestoreState files = 2; */
for (let i = 0; i < message.files.length; i++)
FileRestoreState.internalBinaryWrite(message.files[i], writer.tag(2, WireType.LengthDelimited).fork(), options).join();
/* repeated job_restore.RestoreTape tapes = 2; */
for (let i = 0; i < message.tapes.length; i++)
RestoreTape.internalBinaryWrite(message.tapes[i], writer.tag(2, WireType.LengthDelimited).fork(), options).join();
let u = options.writeUnknownFields;
if (u !== false)
(u == true ? UnknownFieldHandler.onWrite : u)(this.typeName, message, writer);
@@ -503,44 +622,52 @@ class JobStateRestore$Type extends MessageType<JobStateRestore> {
}
}
/**
* @generated MessageType for protobuf message job_restore.JobStateRestore
* @generated MessageType for protobuf message job_restore.JobRestoreState
*/
export const JobStateRestore = new JobStateRestore$Type();
export const JobRestoreState = new JobRestoreState$Type();
// @generated message type with reflection information, may provide speed optimized methods
class JobDisplayRestore$Type extends MessageType<JobDisplayRestore> {
class JobRestoreDisplay$Type extends MessageType<JobRestoreDisplay> {
constructor() {
super("job_restore.JobDisplayRestore", [
{ no: 1, name: "copyedBytes", kind: "scalar", T: 3 /*ScalarType.INT64*/, L: 0 /*LongType.BIGINT*/ },
{ no: 2, name: "copyedFiles", kind: "scalar", T: 3 /*ScalarType.INT64*/, L: 0 /*LongType.BIGINT*/ },
{ no: 3, name: "totalBytes", kind: "scalar", T: 3 /*ScalarType.INT64*/, L: 0 /*LongType.BIGINT*/ },
{ no: 4, name: "totalFiles", kind: "scalar", T: 3 /*ScalarType.INT64*/, L: 0 /*LongType.BIGINT*/ },
super("job_restore.JobRestoreDisplay", [
{ no: 1, name: "copyed_bytes", kind: "scalar", T: 3 /*ScalarType.INT64*/, L: 0 /*LongType.BIGINT*/ },
{ no: 2, name: "copyed_files", kind: "scalar", T: 3 /*ScalarType.INT64*/, L: 0 /*LongType.BIGINT*/ },
{ no: 3, name: "total_bytes", kind: "scalar", T: 3 /*ScalarType.INT64*/, L: 0 /*LongType.BIGINT*/ },
{ no: 4, name: "total_files", kind: "scalar", T: 3 /*ScalarType.INT64*/, L: 0 /*LongType.BIGINT*/ },
{ no: 5, name: "speed", kind: "scalar", opt: true, T: 3 /*ScalarType.INT64*/, L: 0 /*LongType.BIGINT*/ },
{ no: 6, name: "start_time", kind: "scalar", T: 3 /*ScalarType.INT64*/, L: 0 /*LongType.BIGINT*/ },
{ no: 17, name: "logs", kind: "scalar", T: 12 /*ScalarType.BYTES*/ }
]);
}
create(value?: PartialMessage<JobDisplayRestore>): JobDisplayRestore {
const message = { copyedBytes: 0n, copyedFiles: 0n, totalBytes: 0n, totalFiles: 0n, logs: new Uint8Array(0) };
create(value?: PartialMessage<JobRestoreDisplay>): JobRestoreDisplay {
const message = { copyedBytes: 0n, copyedFiles: 0n, totalBytes: 0n, totalFiles: 0n, startTime: 0n, logs: new Uint8Array(0) };
globalThis.Object.defineProperty(message, MESSAGE_TYPE, { enumerable: false, value: this });
if (value !== undefined)
reflectionMergePartial<JobDisplayRestore>(this, message, value);
reflectionMergePartial<JobRestoreDisplay>(this, message, value);
return message;
}
internalBinaryRead(reader: IBinaryReader, length: number, options: BinaryReadOptions, target?: JobDisplayRestore): JobDisplayRestore {
internalBinaryRead(reader: IBinaryReader, length: number, options: BinaryReadOptions, target?: JobRestoreDisplay): JobRestoreDisplay {
let message = target ?? this.create(), end = reader.pos + length;
while (reader.pos < end) {
let [fieldNo, wireType] = reader.tag();
switch (fieldNo) {
case /* int64 copyedBytes */ 1:
case /* int64 copyed_bytes */ 1:
message.copyedBytes = reader.int64().toBigInt();
break;
case /* int64 copyedFiles */ 2:
case /* int64 copyed_files */ 2:
message.copyedFiles = reader.int64().toBigInt();
break;
case /* int64 totalBytes */ 3:
case /* int64 total_bytes */ 3:
message.totalBytes = reader.int64().toBigInt();
break;
case /* int64 totalFiles */ 4:
case /* int64 total_files */ 4:
message.totalFiles = reader.int64().toBigInt();
break;
case /* optional int64 speed */ 5:
message.speed = reader.int64().toBigInt();
break;
case /* int64 start_time */ 6:
message.startTime = reader.int64().toBigInt();
break;
case /* bytes logs */ 17:
message.logs = reader.bytes();
break;
@@ -555,19 +682,25 @@ class JobDisplayRestore$Type extends MessageType<JobDisplayRestore> {
}
return message;
}
internalBinaryWrite(message: JobDisplayRestore, writer: IBinaryWriter, options: BinaryWriteOptions): IBinaryWriter {
/* int64 copyedBytes = 1; */
internalBinaryWrite(message: JobRestoreDisplay, writer: IBinaryWriter, options: BinaryWriteOptions): IBinaryWriter {
/* int64 copyed_bytes = 1; */
if (message.copyedBytes !== 0n)
writer.tag(1, WireType.Varint).int64(message.copyedBytes);
/* int64 copyedFiles = 2; */
/* int64 copyed_files = 2; */
if (message.copyedFiles !== 0n)
writer.tag(2, WireType.Varint).int64(message.copyedFiles);
/* int64 totalBytes = 3; */
/* int64 total_bytes = 3; */
if (message.totalBytes !== 0n)
writer.tag(3, WireType.Varint).int64(message.totalBytes);
/* int64 totalFiles = 4; */
/* int64 total_files = 4; */
if (message.totalFiles !== 0n)
writer.tag(4, WireType.Varint).int64(message.totalFiles);
/* optional int64 speed = 5; */
if (message.speed !== undefined)
writer.tag(5, WireType.Varint).int64(message.speed);
/* int64 start_time = 6; */
if (message.startTime !== 0n)
writer.tag(6, WireType.Varint).int64(message.startTime);
/* bytes logs = 17; */
if (message.logs.length)
writer.tag(17, WireType.LengthDelimited).bytes(message.logs);
@@ -578,6 +711,6 @@ class JobDisplayRestore$Type extends MessageType<JobDisplayRestore> {
}
}
/**
* @generated MessageType for protobuf message job_restore.JobDisplayRestore
* @generated MessageType for protobuf message job_restore.JobRestoreDisplay
*/
export const JobDisplayRestore = new JobDisplayRestore$Type();
export const JobRestoreDisplay = new JobRestoreDisplay$Type();
@@ -0,0 +1,24 @@
// @generated by protobuf-ts 2.8.2
// @generated from protobuf file "library_entity_type.proto" (package "library_entity_type", syntax proto3)
// tslint:disable
/**
* @generated from protobuf enum library_entity_type.LibraryEntityType
*/
export enum LibraryEntityType {
/**
* @generated from protobuf enum value: NONE = 0;
*/
NONE = 0,
/**
* @generated from protobuf enum value: FILE = 1;
*/
FILE = 1,
/**
* @generated from protobuf enum value: TAPE = 2;
*/
TAPE = 2,
/**
* @generated from protobuf enum value: POSITION = 3;
*/
POSITION = 3
}
+53 -14
View File
@@ -4,6 +4,8 @@
import type { RpcTransport } from "@protobuf-ts/runtime-rpc";
import type { ServiceInfo } from "@protobuf-ts/runtime-rpc";
import { Service } from "./service";
import type { LibraryExportReply } from "./service";
import type { LibraryExportRequest } from "./service";
import type { DeviceListReply } from "./service";
import type { DeviceListRequest } from "./service";
import type { SourceListReply } from "./service";
@@ -14,12 +16,16 @@ import type { JobDisplayReply } from "./service";
import type { JobDisplayRequest } from "./service";
import type { JobNextReply } from "./service";
import type { JobNextRequest } from "./service";
import type { JobDeleteReply } from "./service";
import type { JobDeleteRequest } from "./service";
import type { JobCreateReply } from "./service";
import type { JobCreateRequest } from "./service";
import type { JobListReply } from "./service";
import type { JobListRequest } from "./service";
import type { TapeMGetReply } from "./service";
import type { TapeMGetRequest } from "./service";
import type { TapeDeleteReply } from "./service";
import type { TapeDeleteRequest } from "./service";
import type { TapeListReply } from "./service";
import type { TapeListRequest } from "./service";
import type { FileListParentsReply } from "./service";
import type { FileListParentsRequest } from "./service";
import type { FileDeleteReply } from "./service";
@@ -58,9 +64,13 @@ export interface IServiceClient {
*/
fileListParents(input: FileListParentsRequest, options?: RpcOptions): UnaryCall<FileListParentsRequest, FileListParentsReply>;
/**
* @generated from protobuf rpc: TapeMGet(service.TapeMGetRequest) returns (service.TapeMGetReply);
* @generated from protobuf rpc: TapeList(service.TapeListRequest) returns (service.TapeListReply);
*/
tapeMGet(input: TapeMGetRequest, options?: RpcOptions): UnaryCall<TapeMGetRequest, TapeMGetReply>;
tapeList(input: TapeListRequest, options?: RpcOptions): UnaryCall<TapeListRequest, TapeListReply>;
/**
* @generated from protobuf rpc: TapeDelete(service.TapeDeleteRequest) returns (service.TapeDeleteReply);
*/
tapeDelete(input: TapeDeleteRequest, options?: RpcOptions): UnaryCall<TapeDeleteRequest, TapeDeleteReply>;
/**
* @generated from protobuf rpc: JobList(service.JobListRequest) returns (service.JobListReply);
*/
@@ -69,6 +79,10 @@ export interface IServiceClient {
* @generated from protobuf rpc: JobCreate(service.JobCreateRequest) returns (service.JobCreateReply);
*/
jobCreate(input: JobCreateRequest, options?: RpcOptions): UnaryCall<JobCreateRequest, JobCreateReply>;
/**
* @generated from protobuf rpc: JobDelete(service.JobDeleteRequest) returns (service.JobDeleteReply);
*/
jobDelete(input: JobDeleteRequest, options?: RpcOptions): UnaryCall<JobDeleteRequest, JobDeleteReply>;
/**
* @generated from protobuf rpc: JobNext(service.JobNextRequest) returns (service.JobNextReply);
*/
@@ -89,6 +103,10 @@ export interface IServiceClient {
* @generated from protobuf rpc: DeviceList(service.DeviceListRequest) returns (service.DeviceListReply);
*/
deviceList(input: DeviceListRequest, options?: RpcOptions): UnaryCall<DeviceListRequest, DeviceListReply>;
/**
* @generated from protobuf rpc: LibraryExport(service.LibraryExportRequest) returns (service.LibraryExportReply);
*/
libraryExport(input: LibraryExportRequest, options?: RpcOptions): UnaryCall<LibraryExportRequest, LibraryExportReply>;
}
/**
* @generated from protobuf service service.Service
@@ -135,59 +153,80 @@ export class ServiceClient implements IServiceClient, ServiceInfo {
return stackIntercept<FileListParentsRequest, FileListParentsReply>("unary", this._transport, method, opt, input);
}
/**
* @generated from protobuf rpc: TapeMGet(service.TapeMGetRequest) returns (service.TapeMGetReply);
* @generated from protobuf rpc: TapeList(service.TapeListRequest) returns (service.TapeListReply);
*/
tapeMGet(input: TapeMGetRequest, options?: RpcOptions): UnaryCall<TapeMGetRequest, TapeMGetReply> {
tapeList(input: TapeListRequest, options?: RpcOptions): UnaryCall<TapeListRequest, TapeListReply> {
const method = this.methods[5], opt = this._transport.mergeOptions(options);
return stackIntercept<TapeMGetRequest, TapeMGetReply>("unary", this._transport, method, opt, input);
return stackIntercept<TapeListRequest, TapeListReply>("unary", this._transport, method, opt, input);
}
/**
* @generated from protobuf rpc: TapeDelete(service.TapeDeleteRequest) returns (service.TapeDeleteReply);
*/
tapeDelete(input: TapeDeleteRequest, options?: RpcOptions): UnaryCall<TapeDeleteRequest, TapeDeleteReply> {
const method = this.methods[6], opt = this._transport.mergeOptions(options);
return stackIntercept<TapeDeleteRequest, TapeDeleteReply>("unary", this._transport, method, opt, input);
}
/**
* @generated from protobuf rpc: JobList(service.JobListRequest) returns (service.JobListReply);
*/
jobList(input: JobListRequest, options?: RpcOptions): UnaryCall<JobListRequest, JobListReply> {
const method = this.methods[6], opt = this._transport.mergeOptions(options);
const method = this.methods[7], opt = this._transport.mergeOptions(options);
return stackIntercept<JobListRequest, JobListReply>("unary", this._transport, method, opt, input);
}
/**
* @generated from protobuf rpc: JobCreate(service.JobCreateRequest) returns (service.JobCreateReply);
*/
jobCreate(input: JobCreateRequest, options?: RpcOptions): UnaryCall<JobCreateRequest, JobCreateReply> {
const method = this.methods[7], opt = this._transport.mergeOptions(options);
const method = this.methods[8], opt = this._transport.mergeOptions(options);
return stackIntercept<JobCreateRequest, JobCreateReply>("unary", this._transport, method, opt, input);
}
/**
* @generated from protobuf rpc: JobDelete(service.JobDeleteRequest) returns (service.JobDeleteReply);
*/
jobDelete(input: JobDeleteRequest, options?: RpcOptions): UnaryCall<JobDeleteRequest, JobDeleteReply> {
const method = this.methods[9], opt = this._transport.mergeOptions(options);
return stackIntercept<JobDeleteRequest, JobDeleteReply>("unary", this._transport, method, opt, input);
}
/**
* @generated from protobuf rpc: JobNext(service.JobNextRequest) returns (service.JobNextReply);
*/
jobNext(input: JobNextRequest, options?: RpcOptions): UnaryCall<JobNextRequest, JobNextReply> {
const method = this.methods[8], opt = this._transport.mergeOptions(options);
const method = this.methods[10], opt = this._transport.mergeOptions(options);
return stackIntercept<JobNextRequest, JobNextReply>("unary", this._transport, method, opt, input);
}
/**
* @generated from protobuf rpc: JobDisplay(service.JobDisplayRequest) returns (service.JobDisplayReply);
*/
jobDisplay(input: JobDisplayRequest, options?: RpcOptions): UnaryCall<JobDisplayRequest, JobDisplayReply> {
const method = this.methods[9], opt = this._transport.mergeOptions(options);
const method = this.methods[11], opt = this._transport.mergeOptions(options);
return stackIntercept<JobDisplayRequest, JobDisplayReply>("unary", this._transport, method, opt, input);
}
/**
* @generated from protobuf rpc: JobGetLog(service.JobGetLogRequest) returns (service.JobGetLogReply);
*/
jobGetLog(input: JobGetLogRequest, options?: RpcOptions): UnaryCall<JobGetLogRequest, JobGetLogReply> {
const method = this.methods[10], opt = this._transport.mergeOptions(options);
const method = this.methods[12], opt = this._transport.mergeOptions(options);
return stackIntercept<JobGetLogRequest, JobGetLogReply>("unary", this._transport, method, opt, input);
}
/**
* @generated from protobuf rpc: SourceList(service.SourceListRequest) returns (service.SourceListReply);
*/
sourceList(input: SourceListRequest, options?: RpcOptions): UnaryCall<SourceListRequest, SourceListReply> {
const method = this.methods[11], opt = this._transport.mergeOptions(options);
const method = this.methods[13], opt = this._transport.mergeOptions(options);
return stackIntercept<SourceListRequest, SourceListReply>("unary", this._transport, method, opt, input);
}
/**
* @generated from protobuf rpc: DeviceList(service.DeviceListRequest) returns (service.DeviceListReply);
*/
deviceList(input: DeviceListRequest, options?: RpcOptions): UnaryCall<DeviceListRequest, DeviceListReply> {
const method = this.methods[12], opt = this._transport.mergeOptions(options);
const method = this.methods[14], opt = this._transport.mergeOptions(options);
return stackIntercept<DeviceListRequest, DeviceListReply>("unary", this._transport, method, opt, input);
}
/**
* @generated from protobuf rpc: LibraryExport(service.LibraryExportRequest) returns (service.LibraryExportReply);
*/
libraryExport(input: LibraryExportRequest, options?: RpcOptions): UnaryCall<LibraryExportRequest, LibraryExportReply> {
const method = this.methods[15], opt = this._transport.mergeOptions(options);
return stackIntercept<LibraryExportRequest, LibraryExportReply>("unary", this._transport, method, opt, input);
}
}
+410 -12
View File
@@ -12,6 +12,7 @@ import type { PartialMessage } from "@protobuf-ts/runtime";
import { reflectionMergePartial } from "@protobuf-ts/runtime";
import { MESSAGE_TYPE } from "@protobuf-ts/runtime";
import { MessageType } from "@protobuf-ts/runtime";
import { LibraryEntityType } from "./library_entity_type";
import { SourceFile } from "./source";
import { JobDisplay } from "./job";
import { JobNextParam } from "./job";
@@ -19,6 +20,7 @@ import { CreatableJob } from "./job";
import { Job } from "./job";
import { JobFilter } from "./job";
import { Tape } from "./tape";
import { TapeFilter } from "./tape";
import { EditedFile } from "./file";
import { Position } from "./position";
import { File } from "./file";
@@ -124,6 +126,29 @@ export interface FileListParentsReply {
*/
parents: File[];
}
/**
* @generated from protobuf message service.TapeListRequest
*/
export interface TapeListRequest {
/**
* @generated from protobuf oneof: param
*/
param: {
oneofKind: "mget";
/**
* @generated from protobuf field: service.TapeMGetRequest mget = 1;
*/
mget: TapeMGetRequest;
} | {
oneofKind: "list";
/**
* @generated from protobuf field: tape.TapeFilter list = 2;
*/
list: TapeFilter;
} | {
oneofKind: undefined;
};
}
/**
* @generated from protobuf message service.TapeMGetRequest
*/
@@ -134,14 +159,28 @@ export interface TapeMGetRequest {
ids: bigint[];
}
/**
* @generated from protobuf message service.TapeMGetReply
* @generated from protobuf message service.TapeListReply
*/
export interface TapeMGetReply {
export interface TapeListReply {
/**
* @generated from protobuf field: repeated tape.Tape tapes = 1;
*/
tapes: Tape[];
}
/**
* @generated from protobuf message service.TapeDeleteRequest
*/
export interface TapeDeleteRequest {
/**
* @generated from protobuf field: repeated int64 ids = 1;
*/
ids: bigint[];
}
/**
* @generated from protobuf message service.TapeDeleteReply
*/
export interface TapeDeleteReply {
}
/**
* @generated from protobuf message service.JobListRequest
*/
@@ -201,6 +240,20 @@ export interface JobCreateReply {
*/
job?: Job;
}
/**
* @generated from protobuf message service.JobDeleteRequest
*/
export interface JobDeleteRequest {
/**
* @generated from protobuf field: repeated int64 ids = 1;
*/
ids: bigint[];
}
/**
* @generated from protobuf message service.JobDeleteReply
*/
export interface JobDeleteReply {
}
/**
* @generated from protobuf message service.JobNextRequest
*/
@@ -303,6 +356,24 @@ export interface DeviceListReply {
*/
devices: string[];
}
/**
* @generated from protobuf message service.LibraryExportRequest
*/
export interface LibraryExportRequest {
/**
* @generated from protobuf field: repeated library_entity_type.LibraryEntityType types = 1;
*/
types: LibraryEntityType[];
}
/**
* @generated from protobuf message service.LibraryExportReply
*/
export interface LibraryExportReply {
/**
* @generated from protobuf field: bytes json = 1;
*/
json: Uint8Array;
}
// @generated message type with reflection information, may provide speed optimized methods
class FileGetRequest$Type extends MessageType<FileGetRequest> {
constructor() {
@@ -789,6 +860,66 @@ class FileListParentsReply$Type extends MessageType<FileListParentsReply> {
*/
export const FileListParentsReply = new FileListParentsReply$Type();
// @generated message type with reflection information, may provide speed optimized methods
class TapeListRequest$Type extends MessageType<TapeListRequest> {
constructor() {
super("service.TapeListRequest", [
{ no: 1, name: "mget", kind: "message", oneof: "param", T: () => TapeMGetRequest },
{ no: 2, name: "list", kind: "message", oneof: "param", T: () => TapeFilter }
]);
}
create(value?: PartialMessage<TapeListRequest>): TapeListRequest {
const message = { param: { oneofKind: undefined } };
globalThis.Object.defineProperty(message, MESSAGE_TYPE, { enumerable: false, value: this });
if (value !== undefined)
reflectionMergePartial<TapeListRequest>(this, message, value);
return message;
}
internalBinaryRead(reader: IBinaryReader, length: number, options: BinaryReadOptions, target?: TapeListRequest): TapeListRequest {
let message = target ?? this.create(), end = reader.pos + length;
while (reader.pos < end) {
let [fieldNo, wireType] = reader.tag();
switch (fieldNo) {
case /* service.TapeMGetRequest mget */ 1:
message.param = {
oneofKind: "mget",
mget: TapeMGetRequest.internalBinaryRead(reader, reader.uint32(), options, (message.param as any).mget)
};
break;
case /* tape.TapeFilter list */ 2:
message.param = {
oneofKind: "list",
list: TapeFilter.internalBinaryRead(reader, reader.uint32(), options, (message.param as any).list)
};
break;
default:
let u = options.readUnknownField;
if (u === "throw")
throw new globalThis.Error(`Unknown field ${fieldNo} (wire type ${wireType}) for ${this.typeName}`);
let d = reader.skip(wireType);
if (u !== false)
(u === true ? UnknownFieldHandler.onRead : u)(this.typeName, message, fieldNo, wireType, d);
}
}
return message;
}
internalBinaryWrite(message: TapeListRequest, writer: IBinaryWriter, options: BinaryWriteOptions): IBinaryWriter {
/* service.TapeMGetRequest mget = 1; */
if (message.param.oneofKind === "mget")
TapeMGetRequest.internalBinaryWrite(message.param.mget, writer.tag(1, WireType.LengthDelimited).fork(), options).join();
/* tape.TapeFilter list = 2; */
if (message.param.oneofKind === "list")
TapeFilter.internalBinaryWrite(message.param.list, writer.tag(2, WireType.LengthDelimited).fork(), options).join();
let u = options.writeUnknownFields;
if (u !== false)
(u == true ? UnknownFieldHandler.onWrite : u)(this.typeName, message, writer);
return writer;
}
}
/**
* @generated MessageType for protobuf message service.TapeListRequest
*/
export const TapeListRequest = new TapeListRequest$Type();
// @generated message type with reflection information, may provide speed optimized methods
class TapeMGetRequest$Type extends MessageType<TapeMGetRequest> {
constructor() {
super("service.TapeMGetRequest", [
@@ -844,20 +975,20 @@ class TapeMGetRequest$Type extends MessageType<TapeMGetRequest> {
*/
export const TapeMGetRequest = new TapeMGetRequest$Type();
// @generated message type with reflection information, may provide speed optimized methods
class TapeMGetReply$Type extends MessageType<TapeMGetReply> {
class TapeListReply$Type extends MessageType<TapeListReply> {
constructor() {
super("service.TapeMGetReply", [
super("service.TapeListReply", [
{ no: 1, name: "tapes", kind: "message", repeat: 1 /*RepeatType.PACKED*/, T: () => Tape }
]);
}
create(value?: PartialMessage<TapeMGetReply>): TapeMGetReply {
create(value?: PartialMessage<TapeListReply>): TapeListReply {
const message = { tapes: [] };
globalThis.Object.defineProperty(message, MESSAGE_TYPE, { enumerable: false, value: this });
if (value !== undefined)
reflectionMergePartial<TapeMGetReply>(this, message, value);
reflectionMergePartial<TapeListReply>(this, message, value);
return message;
}
internalBinaryRead(reader: IBinaryReader, length: number, options: BinaryReadOptions, target?: TapeMGetReply): TapeMGetReply {
internalBinaryRead(reader: IBinaryReader, length: number, options: BinaryReadOptions, target?: TapeListReply): TapeListReply {
let message = target ?? this.create(), end = reader.pos + length;
while (reader.pos < end) {
let [fieldNo, wireType] = reader.tag();
@@ -876,7 +1007,7 @@ class TapeMGetReply$Type extends MessageType<TapeMGetReply> {
}
return message;
}
internalBinaryWrite(message: TapeMGetReply, writer: IBinaryWriter, options: BinaryWriteOptions): IBinaryWriter {
internalBinaryWrite(message: TapeListReply, writer: IBinaryWriter, options: BinaryWriteOptions): IBinaryWriter {
/* repeated tape.Tape tapes = 1; */
for (let i = 0; i < message.tapes.length; i++)
Tape.internalBinaryWrite(message.tapes[i], writer.tag(1, WireType.LengthDelimited).fork(), options).join();
@@ -887,9 +1018,90 @@ class TapeMGetReply$Type extends MessageType<TapeMGetReply> {
}
}
/**
* @generated MessageType for protobuf message service.TapeMGetReply
* @generated MessageType for protobuf message service.TapeListReply
*/
export const TapeMGetReply = new TapeMGetReply$Type();
export const TapeListReply = new TapeListReply$Type();
// @generated message type with reflection information, may provide speed optimized methods
class TapeDeleteRequest$Type extends MessageType<TapeDeleteRequest> {
constructor() {
super("service.TapeDeleteRequest", [
{ no: 1, name: "ids", kind: "scalar", repeat: 1 /*RepeatType.PACKED*/, T: 3 /*ScalarType.INT64*/, L: 0 /*LongType.BIGINT*/ }
]);
}
create(value?: PartialMessage<TapeDeleteRequest>): TapeDeleteRequest {
const message = { ids: [] };
globalThis.Object.defineProperty(message, MESSAGE_TYPE, { enumerable: false, value: this });
if (value !== undefined)
reflectionMergePartial<TapeDeleteRequest>(this, message, value);
return message;
}
internalBinaryRead(reader: IBinaryReader, length: number, options: BinaryReadOptions, target?: TapeDeleteRequest): TapeDeleteRequest {
let message = target ?? this.create(), end = reader.pos + length;
while (reader.pos < end) {
let [fieldNo, wireType] = reader.tag();
switch (fieldNo) {
case /* repeated int64 ids */ 1:
if (wireType === WireType.LengthDelimited)
for (let e = reader.int32() + reader.pos; reader.pos < e;)
message.ids.push(reader.int64().toBigInt());
else
message.ids.push(reader.int64().toBigInt());
break;
default:
let u = options.readUnknownField;
if (u === "throw")
throw new globalThis.Error(`Unknown field ${fieldNo} (wire type ${wireType}) for ${this.typeName}`);
let d = reader.skip(wireType);
if (u !== false)
(u === true ? UnknownFieldHandler.onRead : u)(this.typeName, message, fieldNo, wireType, d);
}
}
return message;
}
internalBinaryWrite(message: TapeDeleteRequest, writer: IBinaryWriter, options: BinaryWriteOptions): IBinaryWriter {
/* repeated int64 ids = 1; */
if (message.ids.length) {
writer.tag(1, WireType.LengthDelimited).fork();
for (let i = 0; i < message.ids.length; i++)
writer.int64(message.ids[i]);
writer.join();
}
let u = options.writeUnknownFields;
if (u !== false)
(u == true ? UnknownFieldHandler.onWrite : u)(this.typeName, message, writer);
return writer;
}
}
/**
* @generated MessageType for protobuf message service.TapeDeleteRequest
*/
export const TapeDeleteRequest = new TapeDeleteRequest$Type();
// @generated message type with reflection information, may provide speed optimized methods
class TapeDeleteReply$Type extends MessageType<TapeDeleteReply> {
constructor() {
super("service.TapeDeleteReply", []);
}
create(value?: PartialMessage<TapeDeleteReply>): TapeDeleteReply {
const message = {};
globalThis.Object.defineProperty(message, MESSAGE_TYPE, { enumerable: false, value: this });
if (value !== undefined)
reflectionMergePartial<TapeDeleteReply>(this, message, value);
return message;
}
internalBinaryRead(reader: IBinaryReader, length: number, options: BinaryReadOptions, target?: TapeDeleteReply): TapeDeleteReply {
return target ?? this.create();
}
internalBinaryWrite(message: TapeDeleteReply, writer: IBinaryWriter, options: BinaryWriteOptions): IBinaryWriter {
let u = options.writeUnknownFields;
if (u !== false)
(u == true ? UnknownFieldHandler.onWrite : u)(this.typeName, message, writer);
return writer;
}
}
/**
* @generated MessageType for protobuf message service.TapeDeleteReply
*/
export const TapeDeleteReply = new TapeDeleteReply$Type();
// @generated message type with reflection information, may provide speed optimized methods
class JobListRequest$Type extends MessageType<JobListRequest> {
constructor() {
@@ -1147,6 +1359,87 @@ class JobCreateReply$Type extends MessageType<JobCreateReply> {
*/
export const JobCreateReply = new JobCreateReply$Type();
// @generated message type with reflection information, may provide speed optimized methods
class JobDeleteRequest$Type extends MessageType<JobDeleteRequest> {
constructor() {
super("service.JobDeleteRequest", [
{ no: 1, name: "ids", kind: "scalar", repeat: 1 /*RepeatType.PACKED*/, T: 3 /*ScalarType.INT64*/, L: 0 /*LongType.BIGINT*/ }
]);
}
create(value?: PartialMessage<JobDeleteRequest>): JobDeleteRequest {
const message = { ids: [] };
globalThis.Object.defineProperty(message, MESSAGE_TYPE, { enumerable: false, value: this });
if (value !== undefined)
reflectionMergePartial<JobDeleteRequest>(this, message, value);
return message;
}
internalBinaryRead(reader: IBinaryReader, length: number, options: BinaryReadOptions, target?: JobDeleteRequest): JobDeleteRequest {
let message = target ?? this.create(), end = reader.pos + length;
while (reader.pos < end) {
let [fieldNo, wireType] = reader.tag();
switch (fieldNo) {
case /* repeated int64 ids */ 1:
if (wireType === WireType.LengthDelimited)
for (let e = reader.int32() + reader.pos; reader.pos < e;)
message.ids.push(reader.int64().toBigInt());
else
message.ids.push(reader.int64().toBigInt());
break;
default:
let u = options.readUnknownField;
if (u === "throw")
throw new globalThis.Error(`Unknown field ${fieldNo} (wire type ${wireType}) for ${this.typeName}`);
let d = reader.skip(wireType);
if (u !== false)
(u === true ? UnknownFieldHandler.onRead : u)(this.typeName, message, fieldNo, wireType, d);
}
}
return message;
}
internalBinaryWrite(message: JobDeleteRequest, writer: IBinaryWriter, options: BinaryWriteOptions): IBinaryWriter {
/* repeated int64 ids = 1; */
if (message.ids.length) {
writer.tag(1, WireType.LengthDelimited).fork();
for (let i = 0; i < message.ids.length; i++)
writer.int64(message.ids[i]);
writer.join();
}
let u = options.writeUnknownFields;
if (u !== false)
(u == true ? UnknownFieldHandler.onWrite : u)(this.typeName, message, writer);
return writer;
}
}
/**
* @generated MessageType for protobuf message service.JobDeleteRequest
*/
export const JobDeleteRequest = new JobDeleteRequest$Type();
// @generated message type with reflection information, may provide speed optimized methods
class JobDeleteReply$Type extends MessageType<JobDeleteReply> {
constructor() {
super("service.JobDeleteReply", []);
}
create(value?: PartialMessage<JobDeleteReply>): JobDeleteReply {
const message = {};
globalThis.Object.defineProperty(message, MESSAGE_TYPE, { enumerable: false, value: this });
if (value !== undefined)
reflectionMergePartial<JobDeleteReply>(this, message, value);
return message;
}
internalBinaryRead(reader: IBinaryReader, length: number, options: BinaryReadOptions, target?: JobDeleteReply): JobDeleteReply {
return target ?? this.create();
}
internalBinaryWrite(message: JobDeleteReply, writer: IBinaryWriter, options: BinaryWriteOptions): IBinaryWriter {
let u = options.writeUnknownFields;
if (u !== false)
(u == true ? UnknownFieldHandler.onWrite : u)(this.typeName, message, writer);
return writer;
}
}
/**
* @generated MessageType for protobuf message service.JobDeleteReply
*/
export const JobDeleteReply = new JobDeleteReply$Type();
// @generated message type with reflection information, may provide speed optimized methods
class JobNextRequest$Type extends MessageType<JobNextRequest> {
constructor() {
super("service.JobNextRequest", [
@@ -1623,6 +1916,108 @@ class DeviceListReply$Type extends MessageType<DeviceListReply> {
* @generated MessageType for protobuf message service.DeviceListReply
*/
export const DeviceListReply = new DeviceListReply$Type();
// @generated message type with reflection information, may provide speed optimized methods
class LibraryExportRequest$Type extends MessageType<LibraryExportRequest> {
constructor() {
super("service.LibraryExportRequest", [
{ no: 1, name: "types", kind: "enum", repeat: 1 /*RepeatType.PACKED*/, T: () => ["library_entity_type.LibraryEntityType", LibraryEntityType] }
]);
}
create(value?: PartialMessage<LibraryExportRequest>): LibraryExportRequest {
const message = { types: [] };
globalThis.Object.defineProperty(message, MESSAGE_TYPE, { enumerable: false, value: this });
if (value !== undefined)
reflectionMergePartial<LibraryExportRequest>(this, message, value);
return message;
}
internalBinaryRead(reader: IBinaryReader, length: number, options: BinaryReadOptions, target?: LibraryExportRequest): LibraryExportRequest {
let message = target ?? this.create(), end = reader.pos + length;
while (reader.pos < end) {
let [fieldNo, wireType] = reader.tag();
switch (fieldNo) {
case /* repeated library_entity_type.LibraryEntityType types */ 1:
if (wireType === WireType.LengthDelimited)
for (let e = reader.int32() + reader.pos; reader.pos < e;)
message.types.push(reader.int32());
else
message.types.push(reader.int32());
break;
default:
let u = options.readUnknownField;
if (u === "throw")
throw new globalThis.Error(`Unknown field ${fieldNo} (wire type ${wireType}) for ${this.typeName}`);
let d = reader.skip(wireType);
if (u !== false)
(u === true ? UnknownFieldHandler.onRead : u)(this.typeName, message, fieldNo, wireType, d);
}
}
return message;
}
internalBinaryWrite(message: LibraryExportRequest, writer: IBinaryWriter, options: BinaryWriteOptions): IBinaryWriter {
/* repeated library_entity_type.LibraryEntityType types = 1; */
if (message.types.length) {
writer.tag(1, WireType.LengthDelimited).fork();
for (let i = 0; i < message.types.length; i++)
writer.int32(message.types[i]);
writer.join();
}
let u = options.writeUnknownFields;
if (u !== false)
(u == true ? UnknownFieldHandler.onWrite : u)(this.typeName, message, writer);
return writer;
}
}
/**
* @generated MessageType for protobuf message service.LibraryExportRequest
*/
export const LibraryExportRequest = new LibraryExportRequest$Type();
// @generated message type with reflection information, may provide speed optimized methods
class LibraryExportReply$Type extends MessageType<LibraryExportReply> {
constructor() {
super("service.LibraryExportReply", [
{ no: 1, name: "json", kind: "scalar", T: 12 /*ScalarType.BYTES*/ }
]);
}
create(value?: PartialMessage<LibraryExportReply>): LibraryExportReply {
const message = { json: new Uint8Array(0) };
globalThis.Object.defineProperty(message, MESSAGE_TYPE, { enumerable: false, value: this });
if (value !== undefined)
reflectionMergePartial<LibraryExportReply>(this, message, value);
return message;
}
internalBinaryRead(reader: IBinaryReader, length: number, options: BinaryReadOptions, target?: LibraryExportReply): LibraryExportReply {
let message = target ?? this.create(), end = reader.pos + length;
while (reader.pos < end) {
let [fieldNo, wireType] = reader.tag();
switch (fieldNo) {
case /* bytes json */ 1:
message.json = reader.bytes();
break;
default:
let u = options.readUnknownField;
if (u === "throw")
throw new globalThis.Error(`Unknown field ${fieldNo} (wire type ${wireType}) for ${this.typeName}`);
let d = reader.skip(wireType);
if (u !== false)
(u === true ? UnknownFieldHandler.onRead : u)(this.typeName, message, fieldNo, wireType, d);
}
}
return message;
}
internalBinaryWrite(message: LibraryExportReply, writer: IBinaryWriter, options: BinaryWriteOptions): IBinaryWriter {
/* bytes json = 1; */
if (message.json.length)
writer.tag(1, WireType.LengthDelimited).bytes(message.json);
let u = options.writeUnknownFields;
if (u !== false)
(u == true ? UnknownFieldHandler.onWrite : u)(this.typeName, message, writer);
return writer;
}
}
/**
* @generated MessageType for protobuf message service.LibraryExportReply
*/
export const LibraryExportReply = new LibraryExportReply$Type();
/**
* @generated ServiceType for protobuf service service.Service
*/
@@ -1632,12 +2027,15 @@ export const Service = new ServiceType("service.Service", [
{ name: "FileMkdir", options: {}, I: FileMkdirRequest, O: FileMkdirReply },
{ name: "FileDelete", options: {}, I: FileDeleteRequest, O: FileDeleteReply },
{ name: "FileListParents", options: {}, I: FileListParentsRequest, O: FileListParentsReply },
{ name: "TapeMGet", options: {}, I: TapeMGetRequest, O: TapeMGetReply },
{ name: "TapeList", options: {}, I: TapeListRequest, O: TapeListReply },
{ name: "TapeDelete", options: {}, I: TapeDeleteRequest, O: TapeDeleteReply },
{ name: "JobList", options: {}, I: JobListRequest, O: JobListReply },
{ name: "JobCreate", options: {}, I: JobCreateRequest, O: JobCreateReply },
{ name: "JobDelete", options: {}, I: JobDeleteRequest, O: JobDeleteReply },
{ name: "JobNext", options: {}, I: JobNextRequest, O: JobNextReply },
{ name: "JobDisplay", options: {}, I: JobDisplayRequest, O: JobDisplayReply },
{ name: "JobGetLog", options: {}, I: JobGetLogRequest, O: JobGetLogReply },
{ name: "SourceList", options: {}, I: SourceListRequest, O: SourceListReply },
{ name: "DeviceList", options: {}, I: DeviceListRequest, O: DeviceListReply }
{ name: "DeviceList", options: {}, I: DeviceListRequest, O: DeviceListReply },
{ name: "LibraryExport", options: {}, I: LibraryExportRequest, O: LibraryExportReply }
]);
+67
View File
@@ -48,6 +48,19 @@ export interface Tape {
*/
writenBytes: bigint;
}
/**
* @generated from protobuf message tape.TapeFilter
*/
export interface TapeFilter {
/**
* @generated from protobuf field: optional int64 limit = 33;
*/
limit?: bigint;
/**
* @generated from protobuf field: optional int64 offset = 34;
*/
offset?: bigint;
}
// @generated message type with reflection information, may provide speed optimized methods
class Tape$Type extends MessageType<Tape> {
constructor() {
@@ -144,3 +157,57 @@ class Tape$Type extends MessageType<Tape> {
* @generated MessageType for protobuf message tape.Tape
*/
export const Tape = new Tape$Type();
// @generated message type with reflection information, may provide speed optimized methods
class TapeFilter$Type extends MessageType<TapeFilter> {
constructor() {
super("tape.TapeFilter", [
{ no: 33, name: "limit", kind: "scalar", opt: true, T: 3 /*ScalarType.INT64*/, L: 0 /*LongType.BIGINT*/ },
{ no: 34, name: "offset", kind: "scalar", opt: true, T: 3 /*ScalarType.INT64*/, L: 0 /*LongType.BIGINT*/ }
]);
}
create(value?: PartialMessage<TapeFilter>): TapeFilter {
const message = {};
globalThis.Object.defineProperty(message, MESSAGE_TYPE, { enumerable: false, value: this });
if (value !== undefined)
reflectionMergePartial<TapeFilter>(this, message, value);
return message;
}
internalBinaryRead(reader: IBinaryReader, length: number, options: BinaryReadOptions, target?: TapeFilter): TapeFilter {
let message = target ?? this.create(), end = reader.pos + length;
while (reader.pos < end) {
let [fieldNo, wireType] = reader.tag();
switch (fieldNo) {
case /* optional int64 limit */ 33:
message.limit = reader.int64().toBigInt();
break;
case /* optional int64 offset */ 34:
message.offset = reader.int64().toBigInt();
break;
default:
let u = options.readUnknownField;
if (u === "throw")
throw new globalThis.Error(`Unknown field ${fieldNo} (wire type ${wireType}) for ${this.typeName}`);
let d = reader.skip(wireType);
if (u !== false)
(u === true ? UnknownFieldHandler.onRead : u)(this.typeName, message, fieldNo, wireType, d);
}
}
return message;
}
internalBinaryWrite(message: TapeFilter, writer: IBinaryWriter, options: BinaryWriteOptions): IBinaryWriter {
/* optional int64 limit = 33; */
if (message.limit !== undefined)
writer.tag(33, WireType.Varint).int64(message.limit);
/* optional int64 offset = 34; */
if (message.offset !== undefined)
writer.tag(34, WireType.Varint).int64(message.offset);
let u = options.writeUnknownFields;
if (u !== false)
(u == true ? UnknownFieldHandler.onWrite : u)(this.typeName, message, writer);
return writer;
}
}
/**
* @generated MessageType for protobuf message tape.TapeFilter
*/
export const TapeFilter = new TapeFilter$Type();
+189
View File
@@ -0,0 +1,189 @@
import { useState, useEffect, useMemo, useCallback, FC, useRef, RefObject } from "react";
import Grid from "@mui/material/Grid";
import Box from "@mui/material/Box";
import { FileBrowser, FileNavbar, FileToolbar, FileList, FileContextMenu, FileArray, FileBrowserHandle } from "chonky";
import { ChonkyActions, ChonkyFileActionData, FileData } from "chonky";
import { cli, convertSourceFiles } from "../api";
import { Root } from "../api";
import { AddFileAction, RefreshListAction, CreateBackupJobAction } from "../actions";
import { JobArchiveParam, JobCreateRequest, Source } from "../entity";
const useBackupSourceBrowser = (source: RefObject<FileBrowserHandle>) => {
const [files, setFiles] = useState<FileArray>(Array(1).fill(null));
const [folderChain, setFolderChan] = useState<FileArray>([Root]);
const openFolder = useCallback((path: string) => {
(async () => {
const result = await cli.sourceList({ path }).response;
setFiles(convertSourceFiles(result.children));
setFolderChan(convertSourceFiles(result.chain));
})();
}, []);
useEffect(() => openFolder(""), []);
const onFileAction = useCallback(
(data: ChonkyFileActionData) => {
console.log("source", data);
switch (data.id) {
case ChonkyActions.OpenFiles.id:
(async () => {
const { targetFile, files } = data.payload;
const fileToOpen = targetFile ?? files[0];
if (!fileToOpen) {
return;
}
if (fileToOpen.isDir) {
await openFolder(fileToOpen.id);
return;
}
})();
return;
case ChonkyActions.EndDragNDrop.id:
if (!source.current) {
return;
}
source.current.requestFileAction(AddFileAction, data.payload);
return;
}
},
[openFolder, source]
);
const fileActions = useMemo(() => [ChonkyActions.StartDragNDrop, RefreshListAction], []);
return {
files,
folderChain,
onFileAction,
fileActions,
defaultFileViewActionId: ChonkyActions.EnableListView.id,
doubleClickDelay: 300,
};
};
const useBackupTargetBrowser = () => {
const [files, setFiles] = useState<FileArray>(Array(0));
const [folderChain, setFolderChan] = useState<FileArray>([
{
id: "0",
name: "Backup Waitlist",
isDir: true,
openable: true,
selectable: true,
draggable: true,
droppable: true,
},
]);
const onFileAction = useCallback(
(data: ChonkyFileActionData) => {
console.log("target", data);
switch (data.id) {
case ChonkyActions.DeleteFiles.id:
(() => {
const remotedIDs = new Set(data.state.selectedFiles.map((file) => file.id));
setFiles([...files.filter((file) => file && !remotedIDs.has(file.id))]);
})();
return;
case AddFileAction.id:
setFiles([
...files,
...((data.payload as any)?.selectedFiles as FileData[]).map((file) => ({ ...file, name: file.id, openable: false, draggable: false })),
]);
return;
case CreateBackupJobAction.id:
(async () => {
const sources = files
.map((file) => {
if (!file) {
return undefined;
}
let path = file.id.trim();
if (path.length === 0) {
return;
}
while (path.endsWith("/")) {
path = path.slice(0, -1);
}
const splitIdx = path.lastIndexOf("/");
if (splitIdx < 0) {
return;
}
return { base: path.slice(0, splitIdx + 1), path: [path.slice(splitIdx + 1)] } as Source;
})
.filter((source): source is Source => !!source);
const req = makeArchiveParam(1n, { sources });
console.log(req, await cli.jobCreate(req).response);
})();
return;
}
},
[files, setFiles]
);
const fileActions = useMemo(() => [ChonkyActions.DeleteFiles, AddFileAction, CreateBackupJobAction], []);
return {
files,
folderChain,
onFileAction,
fileActions,
defaultFileViewActionId: ChonkyActions.EnableListView.id,
doubleClickDelay: 300,
};
};
export const BackupType = "backup";
export const BackupBrowser = () => {
const target = useRef<FileBrowserHandle>(null);
const sourceProps = useBackupSourceBrowser(target);
const targetProps = useBackupTargetBrowser();
return (
<Box className="browser-box">
<Grid className="browser-container" container>
<Grid className="browser" item xs={6}>
<FileBrowser {...sourceProps}>
<FileNavbar />
<FileToolbar />
<FileList />
<FileContextMenu />
</FileBrowser>
</Grid>
<Grid className="browser" item xs={6}>
<FileBrowser {...targetProps} ref={target}>
<FileNavbar />
<FileToolbar />
<FileList />
<FileContextMenu />
</FileBrowser>
</Grid>
</Grid>
</Box>
);
};
function makeArchiveParam(priority: bigint, param: JobArchiveParam): JobCreateRequest {
return {
job: {
priority,
param: {
param: {
oneofKind: "archive",
archive: param,
},
},
},
};
}
@@ -9,12 +9,11 @@ import moment from "moment";
import { useState, useCallback } from "react";
import "./app.less";
import { cli } from "./api";
import { formatFilesize } from "./tools";
import { cli } from "../api";
import { formatFilesize } from "../tools";
import "./detail.less";
import { FileGetReply, Tape } from "./entity";
import "./file-detail.less";
import { FileGetReply, Tape } from "../entity";
export type Detail = FileGetReply & {
tapes: Map<bigint, Tape>;
@@ -25,8 +24,13 @@ export const useDetailModal = () => {
const openDetailModel = useCallback(
(detail: FileGetReply) => {
(async () => {
const tapeList = await cli.tapeMGet({
ids: detail.positions.map((posi) => posi.tapeId),
const tapeList = await cli.tapeList({
param: {
oneofKind: "mget",
mget: {
ids: detail.positions.map((posi) => posi.tapeId),
},
},
}).response;
const tapes = new Map<bigint, Tape>();
@@ -5,13 +5,12 @@ import Box from "@mui/material/Box";
import { FullFileBrowser, FileBrowserProps, FileBrowserHandle, FileArray } from "chonky";
import { ChonkyActions, ChonkyFileActionData } from "chonky";
import "./app.less";
import { cli, convertFiles } from "./api";
import { Root } from "./api";
import { RenameFileAction, RefreshListAction } from "./actions";
import { cli, convertFiles } from "../api";
import { Root } from "../api";
import { RenameFileAction, RefreshListAction } from "../actions";
import { useDetailModal, DetailModal } from "./detail";
import { FileGetReply } from "./entity";
import { useDetailModal, DetailModal } from "./file-detail";
import { FileGetReply } from "../entity";
const useDualSide = () => {
const left = useRef<FileBrowserHandle>(null);
@@ -1,5 +1,6 @@
import { Fragment, ChangeEvent } from "react";
import { useState, useRef, useEffect, useMemo, useCallback, FC } from "react";
import { createContext, useContext } from "react";
import { assert } from "@protobuf-ts/runtime";
import format from "format-duration";
@@ -17,6 +18,8 @@ import CardContent from "@mui/material/CardContent";
import Button from "@mui/material/Button";
import TextField from "@mui/material/TextField";
import MenuItem from "@mui/material/MenuItem";
import Chip, { ChipProps } from "@mui/material/Chip";
import Stack from "@mui/material/Stack";
import Dialog from "@mui/material/Dialog";
import DialogActions from "@mui/material/DialogActions";
@@ -26,19 +29,24 @@ import DialogTitle from "@mui/material/DialogTitle";
import LinearProgress from "@mui/material/LinearProgress";
import Divider from "@mui/material/Divider";
import "./app.less";
import { cli, sleep } from "./api";
import { Job, JobDisplay, JobCreateRequest, JobListRequest, JobNextRequest, JobStatus, CopyStatus } from "./entity";
import { JobArchiveCopyingParam, JobArchiveStep, JobDisplayArchive, JobParamArchive, JobStateArchive } from "./entity";
import { SourceState } from "./entity";
import { cli, sleep, fileBase } from "../api";
import { Job, JobDisplay, JobListRequest, JobNextRequest, JobStatus, CopyStatus, LibraryEntityType, JobDeleteRequest } from "../entity";
import { formatFilesize } from "./tools";
import { JobArchiveCopyingParam, JobArchiveStep, JobArchiveDisplay, JobArchiveState } from "../entity";
import { SourceState } from "../entity";
import { JobRestoreCopyingParam, JobRestoreStep, JobRestoreDisplay, JobRestoreState } from "../entity";
import { RestoreTape } from "../entity";
import { formatFilesize, download } from "../tools";
export const JobsType = "jobs";
type DisplayableJob = Job & Partial<JobDisplay>;
const RefreshContext = createContext<() => Promise<void>>(async () => {});
export const JobsBrowser = () => {
const [jobs, setJobs] = useState<DisplayableJob[]>([]);
const [jobs, setJobs] = useState<DisplayableJob[] | null>(null);
const refresh = useCallback(async () => {
const jobReplys = await cli.jobList(JobListRequest.create({ param: { oneofKind: "list", list: {} } })).response;
const displayReplys = await Promise.all(jobReplys.jobs.map((job) => cli.jobDisplay({ id: job.id }).response));
@@ -55,35 +63,101 @@ export const JobsBrowser = () => {
}, []);
return (
<Box className="browser-box">
<Grid className="browser-container" container>
<Grid className="browser" item xs={2}>
<List
sx={{
width: "100%",
height: "100%",
bgcolor: "background.paper",
boxSizing: "border-box",
}}
component="nav"
// subheader={
// <ListSubheader component="div" id="nested-list-subheader">
// Nested List Items
// </ListSubheader>
// }
>
<NewArchiveDialog refresh={refresh} />
</List>
<RefreshContext.Provider value={refresh}>
<Box className="browser-box">
<Grid className="browser-container" container>
<Grid className="browser" item xs={2}>
<List
sx={{
width: "100%",
height: "100%",
bgcolor: "background.paper",
boxSizing: "border-box",
}}
component="nav"
// subheader={
// <ListSubheader component="div" id="nested-list-subheader">
// Nested List Items
// </ListSubheader>
// }
>
{/* <NewArchiveDialog refresh={refresh} /> */}
<ListItemButton
onClick={async () => {
const resp = await cli.libraryExport({ types: [LibraryEntityType.FILE, LibraryEntityType.TAPE, LibraryEntityType.POSITION] }).response;
download(resp.json, "database.json", "application/json");
}}
>
<ListItemText primary="Export Database" />
</ListItemButton>
<ImportDatabaseDialog />
</List>
</Grid>
<Grid className="browser" item xs={10}>
<div className="job-list">{jobs ? jobs.map((job) => <GetJobCard job={job} key={job.id.toString()} refresh={refresh} />) : <LinearProgress />}</div>
</Grid>
</Grid>
<Grid className="browser" item xs={10}>
<div className="job-list">
{jobs.map((job) => (
<GetJobCard job={job} key={job.id.toString()} refresh={refresh} />
))}
</div>
</Grid>
</Grid>
</Box>
</Box>
</RefreshContext.Provider>
);
};
const ImportDatabaseDialog = () => {
const [open, setOpen] = useState<boolean>(false);
const [file, setFile] = useState<File | null>(null);
const handleClickOpen = async () => {
setOpen(true);
};
const handleClose = () => {
setOpen(false);
setFile(null);
};
const handleChange = (event: ChangeEvent<HTMLInputElement>) => {
if (!event.target.files) {
return;
}
if (event.target.files.length === 0) {
return;
}
setFile(event.target.files[0]);
};
const handleSubmit = async () => {
if (!file) {
return;
}
const resp = await fetch(fileBase + "/library/_import", {
body: file,
method: "POST",
});
console.log(await resp.json());
handleClose();
};
return (
<Fragment>
<ListItemButton onClick={handleClickOpen}>
<ListItemText primary="Import Database" />
</ListItemButton>
{open && (
<Dialog open={true} onClose={handleClose} maxWidth={"sm"} fullWidth>
<DialogTitle>Load Tape</DialogTitle>
<DialogContent>
<Button variant="contained" component="label">
Upload File
<input type="file" onChange={handleChange} hidden />
</Button>
{file && <p>{file.name}</p>}
</DialogContent>
<DialogActions>
<Button onClick={handleClose}>Cancel</Button>
<Button onClick={handleSubmit}>Submit</Button>
</DialogActions>
</Dialog>
)}
</Fragment>
);
};
@@ -98,12 +172,53 @@ const GetJobCard = ({ job, refresh }: { job: DisplayableJob; refresh: () => Prom
return (
<ArchiveCard job={job} refresh={refresh} state={job.state.state.archive} display={job.display?.oneofKind === "archive" ? job.display.archive : null} />
);
case "restore":
return (
<RestoreCard job={job} refresh={refresh} state={job.state.state.restore} display={job.display?.oneofKind === "restore" ? job.display.restore : null} />
);
default:
return <JobCard job={job} />;
}
};
type ArchiveLastDisplay = { copyedBytes: bigint; lastUpdate: number };
const ArchiveViewFilesDialog = ({ sources }: { sources: SourceState[] }) => {
const [open, setOpen] = useState(false);
const handleClickOpen = () => {
setOpen(true);
};
const handleClose = () => {
setOpen(false);
};
return (
<Fragment>
<Button size="small" onClick={handleClickOpen}>
View Files
</Button>
{open && (
<Dialog open={true} onClose={handleClose} maxWidth={"lg"} fullWidth scroll="paper" sx={{ height: "100%" }} className="view-log-dialog">
<DialogTitle>View Files</DialogTitle>
<DialogContent dividers>
{sources.map((src) => {
if (!src.source) {
return null;
}
return (
<ListItemText
primary={src.source.base + src.source.path.join("/")}
secondary={`Size: ${formatFilesize(src.size)} Status: ${CopyStatus[src.status]}`}
/>
);
})}
</DialogContent>
<DialogActions>
<Button onClick={handleClose}>Close</Button>
</DialogActions>
</Dialog>
)}
</Fragment>
);
};
const ArchiveCard = ({
job,
@@ -112,8 +227,8 @@ const ArchiveCard = ({
refresh,
}: {
job: Job;
state: JobStateArchive;
display: JobDisplayArchive | null;
state: JobArchiveState;
display: JobArchiveDisplay | null;
refresh: () => Promise<void>;
}): JSX.Element => {
const [fields, progress] = useMemo(() => {
@@ -123,7 +238,7 @@ const ArchiveCard = ({
totalBytes = 0;
for (const file of state.sources) {
totalBytes += Number(file.size);
if (file.status !== CopyStatus.Submited) {
if (file.status !== CopyStatus.SUBMITED) {
continue;
}
submitedFiles++;
@@ -183,7 +298,7 @@ const ArchiveCard = ({
}
buttons={
<Fragment>
{state.step === JobArchiveStep.WaitForTape && <LoadTapeDialog job={job} refresh={refresh} />}
{state.step === JobArchiveStep.WAIT_FOR_TAPE && <NewTapeDialog job={job} refresh={refresh} />}
<ViewLogDialog jobID={job.id} />
<ArchiveViewFilesDialog sources={state.sources} />
</Fragment>
@@ -192,7 +307,7 @@ const ArchiveCard = ({
);
};
const NewArchiveDialog = ({ refresh }: { refresh: () => Promise<void> }) => {
const RestoreViewFilesDialog = ({ tapes }: { tapes: RestoreTape[] }) => {
const [open, setOpen] = useState(false);
const handleClickOpen = () => {
setOpen(true);
@@ -201,57 +316,153 @@ const NewArchiveDialog = ({ refresh }: { refresh: () => Promise<void> }) => {
setOpen(false);
};
const [source, setSource] = useState("");
const handleSubmit = async () => {
let path = source.trim();
if (path.length === 0) {
return;
}
while (path.endsWith("/")) {
path = path.slice(0, -1);
}
const splitIdx = path.lastIndexOf("/");
if (splitIdx < 0) {
return;
}
console.log(await cli.jobCreate(makeArchiveParam(1n, { sources: [{ base: path.slice(0, splitIdx + 1), path: [path.slice(splitIdx + 1)] }] })).response);
await refresh();
handleClose();
};
return (
<Fragment>
<ListItemButton onClick={handleClickOpen}>
<ListItemText primary="New Archive Job" />
</ListItemButton>
{open && (
<Dialog open={true} onClose={handleClose} maxWidth={"sm"} fullWidth>
<DialogTitle>New Archive Job</DialogTitle>
<DialogContent>
<TextField
autoFocus
margin="dense"
label="Source Path"
fullWidth
variant="standard"
value={source}
onChange={(event: ChangeEvent<HTMLInputElement>) => setSource(event.target.value)}
/>
<Button size="small" onClick={handleClickOpen}>
View Files
</Button>
{/* {open && (
<Dialog open={true} onClose={handleClose} maxWidth={"lg"} fullWidth scroll="paper" sx={{ height: "100%" }} className="view-log-dialog">
<DialogTitle>View Files</DialogTitle>
<DialogContent dividers>
{tapes.map((tape) => {
if (!src.source) {
return null;
}
return (
<ListItemText
primary={src.source.base + src.source.path.join("/")}
secondary={`Size: ${formatFilesize(src.size)} Status: ${CopyStatus[src.status]}`}
/>
);
})}
</DialogContent>
<DialogActions>
<Button onClick={handleClose}>Cancel</Button>
<Button onClick={handleSubmit}>Submit</Button>
<Button onClick={handleClose}>Close</Button>
</DialogActions>
</Dialog>
)}
)} */}
</Fragment>
);
};
const LoadTapeDialog = ({ job, refresh }: { job: Job; refresh: () => Promise<void> }) => {
const tapeStatusToColor = (status: CopyStatus): ChipProps["color"] => {
switch (status) {
case CopyStatus.DRAFT:
return "primary";
case CopyStatus.PENDING:
return "primary";
case CopyStatus.RUNNING:
return "secondary";
case CopyStatus.STAGED:
return "warning";
case CopyStatus.SUBMITED:
return "success";
case CopyStatus.FAILED:
return "error";
default:
return "default";
}
};
const RestoreCard = ({
job,
state,
display,
refresh,
}: {
job: Job;
state: JobRestoreState;
display: JobRestoreDisplay | null;
refresh: () => Promise<void>;
}): JSX.Element => {
const [fields, progress] = useMemo(() => {
const totalFiles = state.tapes.reduce((count, tape) => count + tape.files.length, 0);
let submitedFiles = 0,
submitedBytes = 0,
totalBytes = 0;
for (const tape of state.tapes) {
for (const file of tape.files) {
totalBytes += Number(file.size);
if (file.status !== CopyStatus.SUBMITED) {
continue;
}
submitedFiles++;
submitedBytes += Number(file.size);
}
}
const copyedFiles = submitedFiles + Number(display?.copyedFiles || 0n);
const copyedBytes = submitedBytes + Number(display?.copyedBytes || 0n);
const avgSpeed = (() => {
if (!display || !display.copyedBytes || !display.startTime) {
return NaN;
}
const duration = Date.now() / 1000 - Number(display.startTime);
if (duration <= 0) {
return NaN;
}
return Number(display.copyedBytes) / duration;
})();
const progress = (totalBytes > 0 ? copyedBytes / totalBytes : 1) * 100;
const fields = [
{ name: "Current Step", value: JobArchiveStep[state.step] },
{ name: "Current Speed", value: display?.speed ? `${formatFilesize(display?.speed)}/s` : "--" },
{ name: "Average Speed", value: !isNaN(avgSpeed) ? `${formatFilesize(avgSpeed)}/s` : "--" },
{ name: "Estimated Time", value: !isNaN(avgSpeed) ? format(((totalBytes - copyedBytes) * 1000) / avgSpeed) : "--" },
{ name: "Total Files", value: totalFiles },
{ name: "Total Bytes", value: formatFilesize(totalBytes) },
{ name: "Submited Files", value: submitedFiles },
{ name: "Submited Bytes", value: formatFilesize(submitedBytes) },
{ name: "Copyed Files", value: copyedFiles },
{ name: "Copyed Bytes", value: formatFilesize(copyedBytes) },
];
return [fields, progress];
}, [state, display]);
return (
<JobCard
job={job}
detail={
<Grid container spacing={2}>
<Grid item xs={12}>
<Box sx={{ paddingTop: "1em" }}>
<LinearProgress variant="determinate" value={progress} />
</Box>
</Grid>
{fields.map((field, idx) => (
<Grid item xs={12} md={3} key={idx}>
<Typography variant="body1">
<b>{field.name}</b>: {field.value}
</Typography>
</Grid>
))}
<Grid item xs={12} md={12}>
<Stack direction="row" spacing={1}>
{state.tapes.map((tape) => (
<Chip label={`${tape.barcode}: ${CopyStatus[tape.status]}`} color={tapeStatusToColor(tape.status)} variant="outlined" key={`${tape.tapeId}`} />
))}
</Stack>
</Grid>
</Grid>
}
buttons={
<Fragment>
{state.step === JobRestoreStep.WAIT_FOR_TAPE && <LoadTapeDialog job={job} refresh={refresh} />}
<ViewLogDialog jobID={job.id} />
<RestoreViewFilesDialog tapes={state.tapes} />
</Fragment>
}
/>
);
};
const NewTapeDialog = ({ job, refresh }: { job: Job; refresh: () => Promise<void> }) => {
const [devices, setDevices] = useState<string[]>([]);
const [param, setParam] = useState<JobArchiveCopyingParam | null>(null);
const handleClickOpen = async () => {
@@ -317,6 +528,64 @@ const LoadTapeDialog = ({ job, refresh }: { job: Job; refresh: () => Promise<voi
);
};
const LoadTapeDialog = ({ job, refresh }: { job: Job; refresh: () => Promise<void> }) => {
const [devices, setDevices] = useState<string[] | null>(null);
const [device, setDevice] = useState<string | null>(null);
const handleClickOpen = async () => {
const reply = await cli.deviceList({}).response;
setDevices(reply.devices);
};
const handleClose = () => {
setDevices(null);
setDevice(null);
};
const handleChange = (event: ChangeEvent<HTMLInputElement>) => {
setDevice(event.target.value);
};
const handleSubmit = async () => {
if (!device) {
return;
}
const trimedParam: JobRestoreCopyingParam = {
device: device,
};
const reply = await cli.jobNext(makeRestoreCopyingParam(job.id, trimedParam)).response;
console.log("job next reply= ", reply);
await refresh();
handleClose();
};
return (
<Fragment>
<Button size="small" onClick={handleClickOpen}>
Load Tape
</Button>
{devices && (
<Dialog open={true} onClose={handleClose} maxWidth={"sm"} fullWidth>
<DialogTitle>Load Tape</DialogTitle>
<DialogContent>
<DialogContentText>After load tape into tape drive, click 'Submit'</DialogContentText>
<TextField select required margin="dense" label="Drive Device" fullWidth variant="standard" value={device} onChange={handleChange}>
{devices.map((device) => (
<MenuItem key={device} value={device}>
{device}
</MenuItem>
))}
</TextField>
</DialogContent>
<DialogActions>
<Button onClick={handleClose}>Cancel</Button>
<Button onClick={handleSubmit}>Submit</Button>
</DialogActions>
</Dialog>
)}
</Fragment>
);
};
const ViewLogDialog = ({ jobID }: { jobID: bigint }) => {
const [open, setOpen] = useState(false);
const handleClickOpen = () => {
@@ -382,42 +651,17 @@ const LogConsole = ({ jobId }: { jobId: bigint }) => {
);
};
const ArchiveViewFilesDialog = ({ sources }: { sources: SourceState[] }) => {
const [open, setOpen] = useState(false);
const handleClickOpen = () => {
setOpen(true);
};
const handleClose = () => {
setOpen(false);
};
const DeleteJobButton = ({ jobID }: { jobID: bigint }) => {
const refresh = useContext(RefreshContext);
const deleteJob = useCallback(async () => {
await cli.jobDelete(JobDeleteRequest.create({ ids: [jobID] }));
await refresh();
}, [jobID]);
return (
<Fragment>
<Button size="small" onClick={handleClickOpen}>
View Files
</Button>
{open && (
<Dialog open={true} onClose={handleClose} maxWidth={"lg"} fullWidth scroll="paper" sx={{ height: "100%" }} className="view-log-dialog">
<DialogTitle>View Files</DialogTitle>
<DialogContent dividers>
{sources.map((src) => {
if (!src.source) {
return null;
}
return (
<ListItemText
primary={src.source.base + src.source.path.join("/")}
secondary={`Size: ${formatFilesize(src.size)} Status: ${CopyStatus[src.status]}`}
/>
);
})}
</DialogContent>
<DialogActions>
<Button onClick={handleClose}>Close</Button>
</DialogActions>
</Dialog>
)}
</Fragment>
<Button size="small" onClick={deleteJob} style={{ marginLeft: "auto", marginRight: 0 }}>
Delete Job
</Button>
);
};
@@ -428,29 +672,18 @@ const JobCard = ({ job, detail, buttons }: { job: Job; detail?: JSX.Element; but
<Typography sx={{ fontSize: 14 }} color="text.secondary" gutterBottom>
{`${JobStatus[job.status]}`}
</Typography>
<Typography variant="h5" component="div">{`${job.state?.state.oneofKind?.toUpperCase()} Job ${job.id}`}</Typography>
<Typography variant="h5" component="div">{`Job ${job.id} - ${job.state?.state.oneofKind?.toUpperCase()}`}</Typography>
{detail}
</CardContent>
<Divider />
<CardActions>{buttons}</CardActions>
<CardActions>
{buttons}
<DeleteJobButton jobID={job.id} />
</CardActions>
</Card>
);
};
function makeArchiveParam(priority: bigint, param: JobParamArchive): JobCreateRequest {
return {
job: {
priority,
param: {
param: {
oneofKind: "archive",
archive: param,
},
},
},
};
}
function makeArchiveCopyingParam(jobID: bigint, param: JobArchiveCopyingParam): JobNextRequest {
return {
id: jobID,
@@ -467,3 +700,20 @@ function makeArchiveCopyingParam(jobID: bigint, param: JobArchiveCopyingParam):
},
};
}
function makeRestoreCopyingParam(jobID: bigint, param: JobRestoreCopyingParam): JobNextRequest {
return {
id: jobID,
param: {
param: {
oneofKind: "restore",
restore: {
param: {
oneofKind: "copying",
copying: param,
},
},
},
},
};
}
+173
View File
@@ -0,0 +1,173 @@
import { useState, useEffect, useMemo, useCallback, FC, useRef, RefObject } from "react";
import Grid from "@mui/material/Grid";
import Box from "@mui/material/Box";
import { FileBrowser, FileNavbar, FileToolbar, FileList, FileContextMenu, FileArray, FileBrowserHandle } from "chonky";
import { ChonkyActions, ChonkyFileActionData, FileData } from "chonky";
import { cli, convertFiles } from "../api";
import { Root } from "../api";
import { AddFileAction, RefreshListAction, CreateRestoreJobAction } from "../actions";
import { JobCreateRequest, JobRestoreParam, Source } from "../entity";
const useRestoreSourceBrowser = (source: RefObject<FileBrowserHandle>) => {
const [files, setFiles] = useState<FileArray>(Array(1).fill(null));
const [folderChain, setFolderChan] = useState<FileArray>([Root]);
const openFolder = useCallback(async (id: string) => {
const [file, folderChain] = await Promise.all([cli.fileGet({ id: BigInt(id) }).response, cli.fileListParents({ id: BigInt(id) }).response]);
setFiles(convertFiles(file.children));
setFolderChan([Root, ...convertFiles(folderChain.parents)]);
}, []);
useEffect(() => {
openFolder(Root.id);
}, []);
const onFileAction = useCallback(
(data: ChonkyFileActionData) => {
console.log("source", data);
switch (data.id) {
case ChonkyActions.OpenFiles.id:
(async () => {
const { targetFile, files } = data.payload;
const fileToOpen = targetFile ?? files[0];
if (!fileToOpen) {
return;
}
if (fileToOpen.isDir) {
await openFolder(fileToOpen.id);
return;
}
})();
return;
case ChonkyActions.EndDragNDrop.id:
(() => {
if (!source.current) {
return;
}
const base = folderChain
.filter((file): file is FileData => !!file && file.id !== "0")
.map((file) => file.name)
.join("/");
source.current.requestFileAction(AddFileAction, {
...data.payload,
selectedFiles: data.payload.selectedFiles.map((file) => ({ ...file, name: base + "/" + file.name })),
});
})();
return;
}
},
[openFolder, source, folderChain]
);
const fileActions = useMemo(() => [ChonkyActions.StartDragNDrop, RefreshListAction], []);
return {
files,
folderChain,
onFileAction,
fileActions,
defaultFileViewActionId: ChonkyActions.EnableListView.id,
doubleClickDelay: 300,
};
};
const useRestoreTargetBrowser = () => {
const [files, setFiles] = useState<FileArray>(Array(0));
const [folderChain, setFolderChan] = useState<FileArray>([
{
id: "0",
name: "Restore Waitlist",
isDir: true,
openable: true,
selectable: true,
draggable: true,
droppable: true,
},
]);
const onFileAction = useCallback(
(data: ChonkyFileActionData) => {
console.log("target", data);
switch (data.id) {
case ChonkyActions.DeleteFiles.id:
(() => {
const remotedIDs = new Set(data.state.selectedFiles.map((file) => file.id));
setFiles([...files.filter((file) => file && !remotedIDs.has(file.id))]);
})();
return;
case AddFileAction.id:
setFiles([...files, ...((data.payload as any)?.selectedFiles as FileData[])]);
return;
case CreateRestoreJobAction.id:
(async () => {
const fileIds = files.filter((file): file is FileData => !!file && file.id !== "0").map((file) => BigInt(file.id));
console.log(await cli.jobCreate(makeParam(1n, { fileIds })).response);
})();
return;
}
},
[files, setFiles]
);
const fileActions = useMemo(() => [ChonkyActions.DeleteFiles, AddFileAction, CreateRestoreJobAction], []);
return {
files,
folderChain,
onFileAction,
fileActions,
defaultFileViewActionId: ChonkyActions.EnableListView.id,
doubleClickDelay: 300,
};
};
export const RestoreType = "restore";
export const RestoreBrowser = () => {
const target = useRef<FileBrowserHandle>(null);
const sourceProps = useRestoreSourceBrowser(target);
const targetProps = useRestoreTargetBrowser();
return (
<Box className="browser-box">
<Grid className="browser-container" container>
<Grid className="browser" item xs={6}>
<FileBrowser {...sourceProps}>
<FileNavbar />
<FileToolbar />
<FileList />
<FileContextMenu />
</FileBrowser>
</Grid>
<Grid className="browser" item xs={6}>
<FileBrowser {...targetProps} ref={target}>
<FileNavbar />
<FileToolbar />
<FileList />
<FileContextMenu />
</FileBrowser>
</Grid>
</Grid>
</Box>
);
};
function makeParam(priority: bigint, param: JobRestoreParam): JobCreateRequest {
return {
job: {
priority,
param: {
param: {
oneofKind: "restore",
restore: param,
},
},
},
};
}
+108
View File
@@ -0,0 +1,108 @@
import { useState, useEffect, useMemo, useCallback, FC, useRef, RefObject } from "react";
import moment from "moment";
import Grid from "@mui/material/Grid";
import Box from "@mui/material/Box";
import { FileBrowser, FileNavbar, FileToolbar, FileList, FileContextMenu, FileArray, FileBrowserHandle } from "chonky";
import { ChonkyActions, ChonkyFileActionData, FileData } from "chonky";
import { cli, Root } from "../api";
import { TapeListRequest, Source, Tape } from "../entity";
export const TapesType = "tapes";
const convertTapes = (tapes: Array<Tape>): FileData[] => {
return tapes.map((tape) => {
// const isDir = (file.mode & ModeDir) > 0;
return {
id: `${tape.id}`,
name: tape.barcode,
ext: "",
isDir: true,
isHidden: false,
openable: false,
selectable: true,
draggable: true,
droppable: false,
size: 0,
modDate: moment.unix(Number(tape.createTime)).toDate(),
};
});
};
const useTapesSourceBrowser = (source: RefObject<FileBrowserHandle>) => {
const [files, setFiles] = useState<FileArray>(Array(1).fill(null));
const [folderChain, setFolderChan] = useState<FileArray>([Root]);
const openFolder = useCallback(async (id: string) => {
const reply = await cli.tapeList({ param: { oneofKind: "list", list: { offset: 0n, limit: 1000n } } }).response;
setFiles(convertTapes(reply.tapes));
setFolderChan([Root]);
}, []);
useEffect(() => {
openFolder(Root.id);
}, []);
const onFileAction = useCallback(
(data: ChonkyFileActionData) => {
console.log("source", data);
switch (data.id) {
case ChonkyActions.OpenFiles.id:
(async () => {
const { targetFile, files } = data.payload;
const fileToOpen = targetFile ?? files[0];
if (!fileToOpen) {
return;
}
if (fileToOpen.isDir) {
await openFolder(fileToOpen.id);
return;
}
})();
return;
case ChonkyActions.DeleteFiles.id:
(async () => {
await cli.tapeDelete({ ids: data.state.selectedFiles.map((file) => BigInt(file.id)) });
})();
return;
}
},
[openFolder, source, folderChain]
);
const fileActions = useMemo(() => [ChonkyActions.DeleteFiles], []);
return {
files,
folderChain,
onFileAction,
fileActions,
defaultFileViewActionId: ChonkyActions.EnableListView.id,
doubleClickDelay: 300,
};
};
export const TapesBrowser = () => {
const target = useRef<FileBrowserHandle>(null);
const sourceProps = useTapesSourceBrowser(target);
return (
<Box className="browser-box">
<Grid className="browser-container" container>
<Grid className="browser" item xs={12}>
<FileBrowser {...sourceProps}>
<FileNavbar />
<FileToolbar />
<FileList />
<FileContextMenu />
</FileBrowser>
</Grid>
</Grid>
</Box>
);
};
+9
View File
@@ -13,3 +13,12 @@ export const formatFilesize = (size: number | bigint): string =>
base: 2,
standard: "jedec",
}) as string;
export const download = (buf: Uint8Array, filename: string, contentType: string) => {
const blob = new Blob([buf], { type: contentType });
const link = document.createElement("a");
link.href = window.URL.createObjectURL(blob);
link.download = filename;
link.click();
};
+1
View File
@@ -19,6 +19,7 @@ export default defineConfig(({ command, mode }) => {
proxy: {
// target http://localhost:5173
"/services": env.DEV_SERVICE_BASE,
"/files": env.DEV_SERVICE_BASE,
},
},
};
+40 -26
View File
@@ -1,62 +1,76 @@
module github.com/abc950309/tapewriter
go 1.18
go 1.20
require (
github.com/abc950309/acp v0.0.0-20221213100222-6351045e0f95
github.com/HewlettPackard/structex v1.0.4
github.com/abc950309/acp v0.0.0-20230516133201-df6caee40899
github.com/aws/aws-sdk-go v1.44.118
github.com/benmcclelland/mtio v0.0.0-20170506231306-f929531fb4fe
github.com/benmcclelland/sgio v0.0.0-20180629175614-f710aebf64c1
github.com/davecgh/go-spew v1.1.1
github.com/deckarep/golang-set/v2 v2.1.0
github.com/gin-contrib/cors v1.4.0
github.com/gin-gonic/gin v1.8.1
github.com/google/uuid v1.3.0
github.com/gin-gonic/gin v1.9.0
github.com/grpc-ecosystem/go-grpc-middleware/v2 v2.0.0-rc.5
github.com/hashicorp/go-multierror v1.1.1
github.com/improbable-eng/grpc-web v0.15.0
github.com/jessevdk/go-flags v1.5.0
github.com/json-iterator/go v1.1.12
github.com/lestrrat-go/file-rotatelogs v2.4.0+incompatible
github.com/modern-go/reflect2 v1.0.2
github.com/rifflock/lfshook v0.0.0-20180920164130-b9218ef580f5
github.com/samber/lo v1.38.1
github.com/sirupsen/logrus v1.9.0
google.golang.org/grpc v1.53.0
google.golang.org/protobuf v1.30.0
gopkg.in/yaml.v2 v2.4.0
gorm.io/driver/mysql v1.3.6
gorm.io/driver/sqlite v1.3.6
gorm.io/gorm v1.23.8
)
require (
github.com/apache/thrift v0.17.0 // indirect
github.com/bytedance/sonic v1.8.0 // indirect
github.com/cenkalti/backoff/v4 v4.1.1 // indirect
github.com/chenzhuoyu/base64x v0.0.0-20221115062448-fe3a3abad311 // indirect
github.com/desertbit/timer v0.0.0-20180107155436-c41aec40b27f // indirect
github.com/gin-contrib/sse v0.1.0 // indirect
github.com/go-playground/locales v0.14.0 // indirect
github.com/go-playground/universal-translator v0.18.0 // indirect
github.com/go-playground/validator/v10 v10.10.0 // indirect
github.com/go-playground/locales v0.14.1 // indirect
github.com/go-playground/universal-translator v0.18.1 // indirect
github.com/go-playground/validator/v10 v10.11.2 // indirect
github.com/go-sql-driver/mysql v1.6.0 // indirect
github.com/goccy/go-json v0.9.7 // indirect
github.com/goccy/go-json v0.10.0 // indirect
github.com/golang/protobuf v1.5.2 // indirect
github.com/hashicorp/errwrap v1.1.0 // indirect
github.com/hashicorp/go-multierror v1.1.1 // indirect
github.com/improbable-eng/grpc-web v0.15.0 // indirect
github.com/jinzhu/inflection v1.0.0 // indirect
github.com/jinzhu/now v1.1.5 // indirect
github.com/jmespath/go-jmespath v0.4.0 // indirect
github.com/json-iterator/go v1.1.12 // indirect
github.com/klauspost/compress v1.11.7 // indirect
github.com/klauspost/cpuid/v2 v2.2.2 // indirect
github.com/leodido/go-urn v1.2.1 // indirect
github.com/mattn/go-isatty v0.0.16 // indirect
github.com/lestrrat-go/strftime v1.0.6 // indirect
github.com/mattn/go-isatty v0.0.17 // indirect
github.com/mattn/go-runewidth v0.0.14 // indirect
github.com/mattn/go-sqlite3 v1.14.12 // indirect
github.com/minio/sha256-simd v1.0.0 // indirect
github.com/mitchellh/colorstring v0.0.0-20190213212951-d06e56a500db // indirect
github.com/moby/sys/mountinfo v0.6.2 // indirect
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
github.com/modern-go/reflect2 v1.0.2 // indirect
github.com/pelletier/go-toml/v2 v2.0.1 // indirect
github.com/pelletier/go-toml/v2 v2.0.6 // indirect
github.com/pkg/errors v0.9.1 // indirect
github.com/rivo/uniseg v0.4.3 // indirect
github.com/rs/cors v1.7.0 // indirect
github.com/schollz/progressbar/v3 v3.12.2 // indirect
github.com/ugorji/go/codec v1.2.7 // indirect
golang.org/x/crypto v0.0.0-20210711020723-a769d52b0f97 // indirect
golang.org/x/net v0.0.0-20220722155237-a158d28d115b // indirect
golang.org/x/sys v0.3.0 // indirect
golang.org/x/term v0.3.0 // indirect
golang.org/x/text v0.4.0 // indirect
google.golang.org/genproto v0.0.0-20210126160654-44e461bb6506 // indirect
google.golang.org/grpc v1.51.0 // indirect
google.golang.org/protobuf v1.28.0 // indirect
gopkg.in/yaml.v2 v2.4.0 // indirect
github.com/twitchyliquid64/golang-asm v0.15.1 // indirect
github.com/ugorji/go/codec v1.2.9 // indirect
golang.org/x/arch v0.0.0-20210923205945-b76863e36670 // indirect
golang.org/x/crypto v0.5.0 // indirect
golang.org/x/exp v0.0.0-20220303212507-bbda1eaf7a17 // indirect
golang.org/x/net v0.8.0 // indirect
golang.org/x/sys v0.6.0 // indirect
golang.org/x/term v0.6.0 // indirect
golang.org/x/text v0.8.0 // indirect
google.golang.org/genproto v0.0.0-20230110181048-76db0878b65f // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
nhooyr.io/websocket v1.8.6 // indirect
)
+84 -92
View File
@@ -3,32 +3,14 @@ cloud.google.com/go v0.34.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMT
dmitri.shuralyov.com/gpu/mtl v0.0.0-20190408044501-666a987793e9/go.mod h1:H6x//7gZCb22OMCxBHrMx7a5I7Hp++hsVxbQ4BYO7hU=
github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU=
github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym/WlBOVXweHU+Q+/VP0lqqI8lqeDx9IjBqo=
github.com/HewlettPackard/structex v1.0.4 h1:RVTdN5FWhDWr1IkjllU8wxuLjISo4gr6u5ryZpzyHcA=
github.com/HewlettPackard/structex v1.0.4/go.mod h1:3frC4RY/cPsP/4+N8rkxsNAGlQwHV+zDC7qvrN+N+rE=
github.com/Knetic/govaluate v3.0.1-0.20171022003610-9aa49832a739+incompatible/go.mod h1:r7JcOSlj0wfOMncg0iLm8Leh48TZaKVeNIfJntJ2wa0=
github.com/Shopify/sarama v1.19.0/go.mod h1:FVkBWblsNy7DGZRfXLU0O9RCGt5g3g3yEuWXgklEdEo=
github.com/Shopify/toxiproxy v2.1.4+incompatible/go.mod h1:OXgGpZ6Cli1/URJOF1DMxUHB2q5Ap20/P/eIdh4G0pI=
github.com/VividCortex/gohistogram v1.0.0/go.mod h1:Pf5mBqqDxYaXu3hDrrU+w6nw50o/4+TcAqDqk/vUH7g=
github.com/abc950309/acp v0.0.0-20221007042439-988889e8bde8 h1:1H4Hcvda/3gEXz3VPYprlFRPgKwkzPLyndUTd+YQzfY=
github.com/abc950309/acp v0.0.0-20221007042439-988889e8bde8/go.mod h1:75zVdd0I1kbDxlaDN4gpQHIMzUdJsIx+6yfb/t3XFjU=
github.com/abc950309/acp v0.0.0-20221207115048-9fa93b905b52 h1:5XCs/jWNyPEQ3hHs7/nHsy4JD/gQ24qjoKFtrbdhHhw=
github.com/abc950309/acp v0.0.0-20221207115048-9fa93b905b52/go.mod h1:5RsleINAlZ326MJ8fmoCW9IJdnlpa6ZVdHqufsfcQMI=
github.com/abc950309/acp v0.0.0-20221207184804-d09399d928be h1:L09WRCT9Nc14hjQmQjRUU2FglUNRisdcUwb2nT8gwj4=
github.com/abc950309/acp v0.0.0-20221207184804-d09399d928be/go.mod h1:5RsleINAlZ326MJ8fmoCW9IJdnlpa6ZVdHqufsfcQMI=
github.com/abc950309/acp v0.0.0-20221208053032-9fde45f6fd43 h1:WSTOZD2ZiUHa4N+o93F5l6C50PJI7D9IFtoDZOWxP14=
github.com/abc950309/acp v0.0.0-20221208053032-9fde45f6fd43/go.mod h1:5RsleINAlZ326MJ8fmoCW9IJdnlpa6ZVdHqufsfcQMI=
github.com/abc950309/acp v0.0.0-20221208153837-7d4accc4414a h1:C3xEvAOvyITHoDwrRwivRHAOlmfeOp4VY0sZ89f6mdI=
github.com/abc950309/acp v0.0.0-20221208153837-7d4accc4414a/go.mod h1:5RsleINAlZ326MJ8fmoCW9IJdnlpa6ZVdHqufsfcQMI=
github.com/abc950309/acp v0.0.0-20221211170531-ae151264e710 h1:WedtGWyNGXdHZDft0XHfMB1YtMn1D2niEH+AYu25Ivk=
github.com/abc950309/acp v0.0.0-20221211170531-ae151264e710/go.mod h1:5RsleINAlZ326MJ8fmoCW9IJdnlpa6ZVdHqufsfcQMI=
github.com/abc950309/acp v0.0.0-20221212144614-c5de5e555428 h1:NQDEsoxNJDxdMuZCJq0R9hqeaR64X8oyEhx0PKUCSwo=
github.com/abc950309/acp v0.0.0-20221212144614-c5de5e555428/go.mod h1:5RsleINAlZ326MJ8fmoCW9IJdnlpa6ZVdHqufsfcQMI=
github.com/abc950309/acp v0.0.0-20221213013859-b7a44e4c0071 h1:sKxesiKeO5dX+TY96m0iegmqvthqH+lN7q5LRG2e8ck=
github.com/abc950309/acp v0.0.0-20221213013859-b7a44e4c0071/go.mod h1:5RsleINAlZ326MJ8fmoCW9IJdnlpa6ZVdHqufsfcQMI=
github.com/abc950309/acp v0.0.0-20221213025816-edd8196e43e6 h1:lgO5pSBYSHqkCYP3/iiFefcsi7udjX1NaujO2cPx5JE=
github.com/abc950309/acp v0.0.0-20221213025816-edd8196e43e6/go.mod h1:7gK/wICIhVBZ6B2AZm+0uN06wDhKLSsq4TME/fwJUJI=
github.com/abc950309/acp v0.0.0-20221213054500-913956ff10a1 h1:UgiD4G3c3WROUHp+elpLVvKuW0+9xErtgkilnDb+XdU=
github.com/abc950309/acp v0.0.0-20221213054500-913956ff10a1/go.mod h1:7gK/wICIhVBZ6B2AZm+0uN06wDhKLSsq4TME/fwJUJI=
github.com/abc950309/acp v0.0.0-20221213100222-6351045e0f95 h1:psZpPKseSGyZlLqJkfaklXlH9KVLzFM/VCQsWoJAm1E=
github.com/abc950309/acp v0.0.0-20221213100222-6351045e0f95/go.mod h1:7gK/wICIhVBZ6B2AZm+0uN06wDhKLSsq4TME/fwJUJI=
github.com/abc950309/acp v0.0.0-20230516133201-df6caee40899 h1:X8Lc97MotJkEWD/1iTjjGvJq4i/owL6gSPSQkFELVck=
github.com/abc950309/acp v0.0.0-20230516133201-df6caee40899/go.mod h1:9KLpYlm8qGkr0+kJ7u2XRXlgImNVZhnymiKyCXeW7lo=
github.com/afex/hystrix-go v0.0.0-20180502004556-fa1af6a1f4f5/go.mod h1:SkGFH1ia65gfNATL8TAiHDNxPzPdmEL5uirI2Uyuz6c=
github.com/alecthomas/template v0.0.0-20160405071501-a0175ee3bccc/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc=
github.com/alecthomas/template v0.0.0-20190718012654-fb15b899a751/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc=
@@ -37,8 +19,6 @@ github.com/alecthomas/units v0.0.0-20190717042225-c3de453c63f4/go.mod h1:ybxpYRF
github.com/alecthomas/units v0.0.0-20190924025748-f65c72e2690d/go.mod h1:rBZYJk541a8SKzHPHnH3zbiI+7dagKZ0cgpgrD7Fyho=
github.com/apache/thrift v0.12.0/go.mod h1:cp2SuWMxlEZw2r+iP2GNCdIi4C1qmUzdZFSVb+bacwQ=
github.com/apache/thrift v0.13.0/go.mod h1:cp2SuWMxlEZw2r+iP2GNCdIi4C1qmUzdZFSVb+bacwQ=
github.com/apache/thrift v0.17.0 h1:cMd2aj52n+8VoAtvSvLn4kDC3aZ6IAkBuqWQ2IDu7wo=
github.com/apache/thrift v0.17.0/go.mod h1:OLxhMRJxomX+1I/KUw03qoV3mMz16BwaKI+d4fPBx7Q=
github.com/armon/circbuf v0.0.0-20150827004946-bbbad097214e/go.mod h1:3U/XgcO3hCbHZ8TKRvWD2dDTCfh9M9ya+I9JpbB7O8o=
github.com/armon/go-metrics v0.0.0-20180917152333-f0300d1749da/go.mod h1:Q73ZrmVTwzkszR9V5SSuryQ31EELlFMUz1kKyl939pY=
github.com/armon/go-radix v0.0.0-20180808171621-7fddfc383310/go.mod h1:ufUuZ+zHj4x4TnLV4JWEpy2hxWSpsRywHrMgIH9cCH8=
@@ -48,17 +28,26 @@ github.com/aws/aws-sdk-go v1.27.0/go.mod h1:KmX6BPdI08NWTb3/sm4ZGu5ShLoqVDhKgpiN
github.com/aws/aws-sdk-go v1.44.118 h1:FJOqIRTukf7+Ulp047/k7JB6eqMXNnj7eb+coORThHQ=
github.com/aws/aws-sdk-go v1.44.118/go.mod h1:y4AeaBuwd2Lk+GepC1E9v0qOiTws0MIWAX4oIKwKHZo=
github.com/aws/aws-sdk-go-v2 v0.18.0/go.mod h1:JWVYvqSMppoMJC0x5wdwiImzgXTI9FuZwxzkQq9wy+g=
github.com/benmcclelland/mtio v0.0.0-20170506231306-f929531fb4fe h1:f+PTGRJrCYSquf31olVAWIqyJwx42eBzVH4D3igzgSk=
github.com/benmcclelland/mtio v0.0.0-20170506231306-f929531fb4fe/go.mod h1:XyVqnMjuqI1qOvgei81EgX68tV7BjN9JlluJPsjArs0=
github.com/benmcclelland/sgio v0.0.0-20180629175614-f710aebf64c1 h1:f1AIRyf6d21xBd1DirrIa6fk41O3LB0WvVuVqhPN4co=
github.com/benmcclelland/sgio v0.0.0-20180629175614-f710aebf64c1/go.mod h1:WdrapyVn/Aduwwf/OMW6sEtk9+7BSoMst1kGrx4E4xE=
github.com/beorn7/perks v0.0.0-20180321164747-3a771d992973/go.mod h1:Dwedo/Wpr24TaqPxmxbtue+5NUziq4I4S80YR8gNf3Q=
github.com/beorn7/perks v1.0.0/go.mod h1:KWe93zE9D1o94FZ5RNwFwVgaQK1VOXiVxmqh+CedLV8=
github.com/beorn7/perks v1.0.1/go.mod h1:G2ZrVWU2WbWT9wwq4/hrbKbnv/1ERSJQ0ibhJ6rlkpw=
github.com/bgentry/speakeasy v0.1.0/go.mod h1:+zsyZBPWlz7T6j88CTgSN5bM796AkVf0kBD4zp0CCIs=
github.com/bytedance/sonic v1.5.0/go.mod h1:ED5hyg4y6t3/9Ku1R6dU/4KyJ48DZ4jPhfY1O2AihPM=
github.com/bytedance/sonic v1.8.0 h1:ea0Xadu+sHlu7x5O3gKhRpQ1IKiMrSiHttPF0ybECuA=
github.com/bytedance/sonic v1.8.0/go.mod h1:i736AoUSYt75HyZLoJW9ERYxcy6eaN6h4BZXU064P/U=
github.com/casbin/casbin/v2 v2.1.2/go.mod h1:YcPU1XXisHhLzuxH9coDNf2FbKpjGlbCg3n9yuLkIJQ=
github.com/cenkalti/backoff v2.2.1+incompatible h1:tNowT99t7UNflLxfYYSlKYsBpXdEet03Pg2g16Swow4=
github.com/cenkalti/backoff v2.2.1+incompatible/go.mod h1:90ReRw6GdpyfrHakVjL/QHaoyV4aDUVVkXQJJJ3NXXM=
github.com/cenkalti/backoff/v4 v4.1.1 h1:G2HAfAmvm/GcKan2oOQpBXOd2tT2G57ZnZGWa1PxPBQ=
github.com/cenkalti/backoff/v4 v4.1.1/go.mod h1:scbssz8iZGpm3xbr14ovlUdkxfGXNInqkPWOWmG2CLw=
github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU=
github.com/cespare/xxhash/v2 v2.1.1/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs=
github.com/chenzhuoyu/base64x v0.0.0-20211019084208-fb5309c8db06/go.mod h1:DH46F32mSOjUmXrMHnKwZdA8wcEefY7UVqBKYGjpdQY=
github.com/chenzhuoyu/base64x v0.0.0-20221115062448-fe3a3abad311 h1:qSGYFH7+jGhDF8vLC+iwCD4WpbV1EBDSzWkJODFLams=
github.com/chenzhuoyu/base64x v0.0.0-20221115062448-fe3a3abad311/go.mod h1:b583jCggY9gE99b6G5LEC39OIiVsWj+R97kbl5odCEk=
github.com/clbanning/x2j v0.0.0-20191024224557-825249438eec/go.mod h1:jMjuTZXRI4dUb/I5gc9Hdhagfvm9+RyrPryS/auMzxE=
github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw=
github.com/cncf/udpa/go v0.0.0-20191209042840-269d4d468f6f/go.mod h1:M8M6+tZqaGXZJjfX53e64911xZQV5JYwmTeXPW+k8Sc=
@@ -69,7 +58,6 @@ github.com/coreos/go-systemd v0.0.0-20180511133405-39ca1b05acc7/go.mod h1:F5haX7
github.com/coreos/pkg v0.0.0-20160727233714-3ac0863d7acf/go.mod h1:E3G3o1h8I7cfcXa63jLwjI0eiQQMgzzUDFVpN/nH/eA=
github.com/cpuguy83/go-md2man/v2 v2.0.0-20190314233015-f79a8a8ca69d/go.mod h1:maD7wRr/U5Z6m/iR4s+kqSMx2CaBsrgA7czyZG/E6dU=
github.com/creack/pty v1.1.7/go.mod h1:lj5s0c3V2DBrqTV7llrYr5NG6My20zk30Fl46Y7DoTY=
github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E=
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
@@ -93,13 +81,11 @@ github.com/franela/goblin v0.0.0-20200105215937-c9ffbefa60db/go.mod h1:7dvUGVsVB
github.com/franela/goreq v0.0.0-20171204163338-bcd34c9993f8/go.mod h1:ZhphrRTfi2rbfLwlschooIH4+wKKDR4Pdxhh+TRoA20=
github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo=
github.com/ghodss/yaml v1.0.0/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04=
github.com/gin-contrib/cors v1.4.0 h1:oJ6gwtUl3lqV0WEIwM/LxPF1QZ5qe2lGWdY2+bz7y0g=
github.com/gin-contrib/cors v1.4.0/go.mod h1:bs9pNM0x/UsmHPBWT2xZz9ROh8xYjYkiURUfmBoMlcs=
github.com/gin-contrib/sse v0.1.0 h1:Y/yl/+YNO8GZSjAhjMsSuLt29uWRFHdHYUb5lYOV9qE=
github.com/gin-contrib/sse v0.1.0/go.mod h1:RHrZQHXnP2xjPF+u1gW/2HnVO7nvIa9PG3Gm+fLHvGI=
github.com/gin-gonic/gin v1.6.3/go.mod h1:75u5sXoLsGZoRN5Sgbi1eraJ4GU3++wFwWzhwvtwp4M=
github.com/gin-gonic/gin v1.8.1 h1:4+fr/el88TOO3ewCmQr8cx/CtZ/umlIRIs5M4NTNjf8=
github.com/gin-gonic/gin v1.8.1/go.mod h1:ji8BvRH1azfM+SYow9zQ6SZMvR8qOMZHmsCuWR9tTTk=
github.com/gin-gonic/gin v1.9.0 h1:OjyFBKICoexlu99ctXNR2gg+c5pKrKMuyjgARg9qeY8=
github.com/gin-gonic/gin v1.9.0/go.mod h1:W1Me9+hsUSyj3CePGrd1/QrKJMSJ1Tu/0hFEH89961k=
github.com/go-gl/glfw/v3.3/glfw v0.0.0-20200222043503-6f7a984d4dc4/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8=
github.com/go-kit/kit v0.8.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as=
github.com/go-kit/kit v0.9.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as=
@@ -107,26 +93,29 @@ github.com/go-kit/kit v0.10.0/go.mod h1:xUsJbQ/Fp4kEt7AFgCuvyX4a71u8h9jB8tj/ORgO
github.com/go-logfmt/logfmt v0.3.0/go.mod h1:Qt1PoO58o5twSAckw1HlFXLmHsOX5/0LbT9GBnD5lWE=
github.com/go-logfmt/logfmt v0.4.0/go.mod h1:3RMwSq7FuexP4Kalkev3ejPJsZTpXXBr9+V4qmtdjCk=
github.com/go-logfmt/logfmt v0.5.0/go.mod h1:wCYkCAKZfumFQihp8CzCvQ3paCTfi41vtzG1KdI/P7A=
github.com/go-playground/assert/v2 v2.0.1 h1:MsBgLAaY856+nPRTKrp3/OZK38U/wa0CcBYNjji3q3A=
github.com/go-playground/assert/v2 v2.0.1/go.mod h1:VDjEfimB/XKnb+ZQfWdccd7VUvScMdVu0Titje2rxJ4=
github.com/go-playground/assert/v2 v2.2.0 h1:JvknZsQTYeFEAhQwI4qEt9cyV5ONwRHC+lYKSsYSR8s=
github.com/go-playground/locales v0.13.0/go.mod h1:taPMhCMXrRLJO55olJkUXHZBHCxTMfnGwq/HNwmWNS8=
github.com/go-playground/locales v0.14.0 h1:u50s323jtVGugKlcYeyzC0etD1HifMjqmJqb8WugfUU=
github.com/go-playground/locales v0.14.0/go.mod h1:sawfccIbzZTqEDETgFXqTho0QybSa7l++s0DH+LDiLs=
github.com/go-playground/locales v0.14.1 h1:EWaQ/wswjilfKLTECiXz7Rh+3BjFhfDFKv/oXslEjJA=
github.com/go-playground/locales v0.14.1/go.mod h1:hxrqLVvrK65+Rwrd5Fc6F2O76J/NuW9t0sjnWqG1slY=
github.com/go-playground/universal-translator v0.17.0/go.mod h1:UkSxE5sNxxRwHyU+Scu5vgOQjsIJAF8j9muTVoKLVtA=
github.com/go-playground/universal-translator v0.18.0 h1:82dyy6p4OuJq4/CByFNOn/jYrnRPArHwAcmLoJZxyho=
github.com/go-playground/universal-translator v0.18.0/go.mod h1:UvRDBj+xPUEGrFYl+lu/H90nyDXpg0fqeB/AQUGNTVA=
github.com/go-playground/universal-translator v0.18.1 h1:Bcnm0ZwsGyWbCzImXv+pAJnYK9S473LQFuzCbDbfSFY=
github.com/go-playground/universal-translator v0.18.1/go.mod h1:xekY+UJKNuX9WP91TpwSH2VMlDf28Uj24BCp08ZFTUY=
github.com/go-playground/validator/v10 v10.2.0/go.mod h1:uOYAAleCW8F/7oMFd6aG0GOhaH6EGOAJShg8Id5JGkI=
github.com/go-playground/validator/v10 v10.10.0 h1:I7mrTYv78z8k8VXa/qJlOlEXn/nBh+BF8dHX5nt/dr0=
github.com/go-playground/validator/v10 v10.10.0/go.mod h1:74x4gJWsvQexRdW8Pn3dXSGrTK4nAUsbPlLADvpJkos=
github.com/go-playground/validator/v10 v10.11.2 h1:q3SHpufmypg+erIExEKUmsgmhDTyhcJ38oeKGACXohU=
github.com/go-playground/validator/v10 v10.11.2/go.mod h1:NieE624vt4SCTJtD87arVLvdmjPAeV8BQlHtMnw9D7s=
github.com/go-sql-driver/mysql v1.4.0/go.mod h1:zAC/RDZ24gD3HViQzih4MyKcchzm+sOG5ZlKdlhCg5w=
github.com/go-sql-driver/mysql v1.6.0 h1:BCTh4TKNUYmOmMUcQ3IipzF5prigylS7XXjEkfCHuOE=
github.com/go-sql-driver/mysql v1.6.0/go.mod h1:DCzpHaOWr8IXmIStZouvnhqoel9Qv2LBy8hT2VhHyBg=
github.com/go-stack/stack v1.8.0/go.mod h1:v0f6uXyyMGvRgIKkXu+yp6POWl0qKG85gN/melR3HDY=
github.com/gobwas/httphead v0.0.0-20180130184737-2c6c146eadee h1:s+21KNqlpePfkah2I+gwHF8xmJWRjooY+5248k6m4A0=
github.com/gobwas/httphead v0.0.0-20180130184737-2c6c146eadee/go.mod h1:L0fX3K22YWvt/FAX9NnzrNzcI4wNYi9Yku4O0LKYflo=
github.com/gobwas/pool v0.2.0 h1:QEmUOlnSjWtnpRGHF3SauEiOsy82Cup83Vf2LcMlnc8=
github.com/gobwas/pool v0.2.0/go.mod h1:q8bcK0KcYlCgd9e7WYLm9LpyS+YeLd8JVDW6WezmKEw=
github.com/gobwas/ws v1.0.2 h1:CoAavW/wd/kulfZmSIBt6p24n4j7tHgNVCjsfHVNUbo=
github.com/gobwas/ws v1.0.2/go.mod h1:szmBTxLgaFppYjEmNtny/v3w89xOydFnnZMcgRRu/EM=
github.com/goccy/go-json v0.9.7 h1:IcB+Aqpx/iMHu5Yooh7jEzJk1JZ7Pjtmys2ukPr7EeM=
github.com/goccy/go-json v0.9.7/go.mod h1:6MelG93GURQebXPDq3khkgXZkazVtN9CRI+MGFi0w8I=
github.com/goccy/go-json v0.10.0 h1:mXKd9Qw4NuzShiRlOXKews24ufknHO7gx30lsDyokKA=
github.com/goccy/go-json v0.10.0/go.mod h1:6MelG93GURQebXPDq3khkgXZkazVtN9CRI+MGFi0w8I=
github.com/gogo/googleapis v1.1.0/go.mod h1:gf4bu3Q80BeJ6H1S1vYPm8/ELATdvryBaNFGgqEef3s=
github.com/gogo/protobuf v1.1.1/go.mod h1:r8qH/GZQm5c6nD/R0oafs1akxWv10x8SbQlK7atdtwQ=
github.com/gogo/protobuf v1.2.0/go.mod h1:r8qH/GZQm5c6nD/R0oafs1akxWv10x8SbQlK7atdtwQ=
@@ -159,21 +148,22 @@ github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMyw
github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU=
github.com/google/go-cmp v0.4.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
github.com/google/go-cmp v0.5.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
github.com/google/go-cmp v0.5.5 h1:Khx7svrCpmxxtHBq5j2mp/xVjsi8hQMfNLvJFAlrGgU=
github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
github.com/google/go-cmp v0.5.9 h1:O2Tfq5qg4qc4AmwVlvv0oLiVAGB7enBSJ2x2DqQFi38=
github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg=
github.com/google/renameio v0.1.0/go.mod h1:KWCgfxg9yswjAJkECMjeO8J8rahYeXnNhOm40UhjYkI=
github.com/google/uuid v1.0.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
github.com/google/uuid v1.3.0 h1:t6JiXgmwXMjEs8VusXIJk2BXHsn+wx8BZdTaoZ5fu7I=
github.com/google/uuid v1.3.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
github.com/gopherjs/gopherjs v0.0.0-20181017120253-0766667cb4d1/go.mod h1:wJfORRmW1u3UXTncJ5qlYoELFm8eSnnEO6hX4iZ3EWY=
github.com/gorilla/context v1.1.1/go.mod h1:kBGZzfjB9CEq2AlWe17Uuf7NDRt0dE0s8S51q0aT7Yg=
github.com/gorilla/mux v1.6.2/go.mod h1:1lud6UwP+6orDFRuTfBEV8e9/aOM/c4fVVCaMa2zaAs=
github.com/gorilla/mux v1.7.3/go.mod h1:1lud6UwP+6orDFRuTfBEV8e9/aOM/c4fVVCaMa2zaAs=
github.com/gorilla/websocket v0.0.0-20170926233335-4201258b820c/go.mod h1:E7qHFY5m1UJ88s3WnNqhKjPHQ0heANvMoAMk2YaljkQ=
github.com/gorilla/websocket v1.4.1 h1:q7AeDBpnBk8AogcD4DSag/Ukw/KV+YhzLj2bP5HvKCM=
github.com/gorilla/websocket v1.4.1/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE=
github.com/grpc-ecosystem/go-grpc-middleware v1.0.1-0.20190118093823-f849b5445de4/go.mod h1:FiyG127CGDf3tlThmgyCl78X/SZQqEOJBCDaAfeWzPs=
github.com/grpc-ecosystem/go-grpc-middleware v1.2.2/go.mod h1:EaizFBKfUKtMIF5iaDEhniwNedqGo9FuLFzppDr3uwI=
github.com/grpc-ecosystem/go-grpc-middleware/v2 v2.0.0-rc.5 h1:3IZOAnD058zZllQTZNBioTlrzrBG/IjpiZ133IEtusM=
github.com/grpc-ecosystem/go-grpc-middleware/v2 v2.0.0-rc.5/go.mod h1:xbKERva94Pw2cPen0s79J3uXmGzbbpDYFBFDlZ4mV/w=
github.com/grpc-ecosystem/go-grpc-prometheus v1.2.0/go.mod h1:8NvIoxWQoOIhqOTXgfV/d3M/q6VIi02HzZEHgUlZvzk=
github.com/grpc-ecosystem/grpc-gateway v1.9.5/go.mod h1:vNeuVxBJEsws4ogUvrchl83t/GYV9WGTSLVdBhOQFDY=
github.com/hashicorp/consul/api v1.3.0/go.mod h1:MmDNSzIMUjNpY/mQ398R4bk2FnqQLoPndWW5VkKPlCE=
@@ -206,6 +196,8 @@ github.com/improbable-eng/grpc-web v0.15.0 h1:BN+7z6uNXZ1tQGcNAuaU1YjsLTApzkjt2t
github.com/improbable-eng/grpc-web v0.15.0/go.mod h1:1sy9HKV4Jt9aEs9JSnkWlRJPuPtwNr0l57L4f878wP8=
github.com/inconshreveable/mousetrap v1.0.0/go.mod h1:PxqpIevigyE2G7u3NXJIT2ANytuPF1OarO4DADm73n8=
github.com/influxdata/influxdb1-client v0.0.0-20191209144304-8bf82d3c094d/go.mod h1:qj24IKcXYK6Iy9ceXlo3Tc+vtHo9lIhSX5JddghvEPo=
github.com/jessevdk/go-flags v1.5.0 h1:1jKYvbxEjfUl0fmqTCOfonvskHHXMjBySTLW4y9LFvc=
github.com/jessevdk/go-flags v1.5.0/go.mod h1:Fw0T6WPc1dYxT4mKEZRfG5kJhaTDP9pj1c2EWnYs/m4=
github.com/jinzhu/inflection v1.0.0 h1:K317FqzuhWc8YvSVlFMCCUb36O/S9MCKRDI7QkRKD/E=
github.com/jinzhu/inflection v1.0.0/go.mod h1:h+uFLlag+Qp1Va5pdKtLDYj+kHp5pxUVkryuEj+Srlc=
github.com/jinzhu/now v1.1.4/go.mod h1:d3SSVoowX0Lcu0IBviAWJpolVfI5UJVZZ7cO71lE/z8=
@@ -216,6 +208,7 @@ github.com/jmespath/go-jmespath v0.4.0 h1:BEgLn5cpjn8UN1mAw4NjwDrS35OdebyEtFe+9Y
github.com/jmespath/go-jmespath v0.4.0/go.mod h1:T8mJZnbsbmF+m6zOOFylbeCJqk5+pHWvzYPziyZiYoo=
github.com/jmespath/go-jmespath/internal/testify v1.5.1 h1:shLQSRRSCCPj3f2gpwzGwWFoC7ycTf1rcQZHOlsJ6N8=
github.com/jmespath/go-jmespath/internal/testify v1.5.1/go.mod h1:L3OGu8Wl2/fWfCI6z80xFu9LTZmf1ZRjMHUOPmWr69U=
github.com/jonboulle/clockwork v0.1.0 h1:VKV+ZcuP6l3yW9doeqz6ziZGgcynBVQO+obU0+0hcPo=
github.com/jonboulle/clockwork v0.1.0/go.mod h1:Ii8DK3G1RaLaWxj9trq07+26W01tbo22gdxWY5EU2bo=
github.com/jpillora/backoff v1.0.0/go.mod h1:J/6gKK9jxlEcS3zixgDgUAsiuZ7yrSoa/FX5e0EB2j4=
github.com/json-iterator/go v1.1.6/go.mod h1:+SdeFBvtyEkXs7REEP0seUULqWtbJapLOCVDaaPEHmU=
@@ -235,24 +228,26 @@ github.com/klauspost/compress v1.10.3/go.mod h1:aoV0uJVorq1K+umq18yTdKaF57EivdYs
github.com/klauspost/compress v1.11.7 h1:0hzRabrMN4tSTvMfnL3SCv1ZGeAP23ynzodBgaHeMeg=
github.com/klauspost/compress v1.11.7/go.mod h1:aoV0uJVorq1K+umq18yTdKaF57EivdYsUV+/s2qKfXs=
github.com/klauspost/cpuid/v2 v2.0.4/go.mod h1:FInQzS24/EEf25PyTYn52gqo7WaD8xa0213Md/qVLRg=
github.com/klauspost/cpuid/v2 v2.1.1 h1:t0wUqjowdm8ezddV5k0tLWVklVuvLJpoHeb4WBdydm0=
github.com/klauspost/cpuid/v2 v2.1.1/go.mod h1:RVVoqg1df56z8g3pUjL/3lE5UfnlrJX8tyFgg4nqhuY=
github.com/klauspost/cpuid/v2 v2.0.9/go.mod h1:FInQzS24/EEf25PyTYn52gqo7WaD8xa0213Md/qVLRg=
github.com/klauspost/cpuid/v2 v2.2.2 h1:xPMwiykqNK9VK0NYC3+jTMYv9I6Vl3YdjZgPZKG3zO0=
github.com/klauspost/cpuid/v2 v2.2.2/go.mod h1:RVVoqg1df56z8g3pUjL/3lE5UfnlrJX8tyFgg4nqhuY=
github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ=
github.com/konsorten/go-windows-terminal-sequences v1.0.3/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ=
github.com/kr/logfmt v0.0.0-20140226030751-b84e30acd515/go.mod h1:+0opPa2QZZtGFBFZlji/RkVcI2GknAs/DXo4wKdlNEc=
github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo=
github.com/kr/pretty v0.2.1/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfnI=
github.com/kr/pretty v0.3.0 h1:WgNl7dwNpEZ6jJ9k1snq4pZsg7DOEN8hP9Xw0Tsjwk0=
github.com/kr/pretty v0.3.0/go.mod h1:640gp4NfQd8pI5XOwp5fnNeVWj67G7CFk/SaSQn7NBk=
github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ=
github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI=
github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY=
github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE=
github.com/leodido/go-urn v1.2.0/go.mod h1:+8+nEpDfqqsY+g338gtMEUOtuK+4dEMhiQEgxpxOKII=
github.com/leodido/go-urn v1.2.1 h1:BqpAaACuzVSgi/VLzGZIobT2z4v53pjosyNd9Yv6n/w=
github.com/leodido/go-urn v1.2.1/go.mod h1:zt4jvISO2HfUBqxjfIshjdMTYS56ZS/qv49ictyFfxY=
github.com/lestrrat-go/envload v0.0.0-20180220234015-a3eb8ddeffcc h1:RKf14vYWi2ttpEmkA4aQ3j4u9dStX2t4M8UM6qqNsG8=
github.com/lestrrat-go/envload v0.0.0-20180220234015-a3eb8ddeffcc/go.mod h1:kopuH9ugFRkIXf3YoqHKyrJ9YfUFsckUU9S7B+XP+is=
github.com/lestrrat-go/file-rotatelogs v2.4.0+incompatible h1:Y6sqxHMyB1D2YSzWkLibYKgg+SwmyFU9dF2hn6MdTj4=
github.com/lestrrat-go/file-rotatelogs v2.4.0+incompatible/go.mod h1:ZQnN8lSECaebrkQytbHj4xNgtg8CR7RYXnPok8e0EHA=
github.com/lestrrat-go/strftime v1.0.6 h1:CFGsDEt1pOpFNU+TJB0nhz9jl+K0hZSLE205AhTIGQQ=
github.com/lestrrat-go/strftime v1.0.6/go.mod h1:f7jQKgV5nnJpYgdEasS+/y7EsTb8ykN2z68n3TtcTaw=
github.com/lightstep/lightstep-tracer-common/golang/gogo v0.0.0-20190605223551-bc2310a04743/go.mod h1:qklhhLq1aX+mtWk9cPHPzaBjWImj5ULL6C7HFJtXQMM=
github.com/lightstep/lightstep-tracer-go v0.18.1/go.mod h1:jlF1pusYV4pidLvZ+XD0UBX0ZE6WURAspgAczcDHrL4=
github.com/lyft/protoc-gen-validate v0.0.13/go.mod h1:XbGvPuh87YZc5TdIa2/I4pLk0QoUACkjt2znoq26NVQ=
@@ -260,12 +255,10 @@ github.com/mattn/go-colorable v0.0.9/go.mod h1:9vuHe8Xs5qXnSaW/c/ABM9alt+Vo+STaO
github.com/mattn/go-isatty v0.0.3/go.mod h1:M+lRXTBqGeGNdLjl/ufCoiOlB5xdOkqRJdNxMWT7Zi4=
github.com/mattn/go-isatty v0.0.4/go.mod h1:M+lRXTBqGeGNdLjl/ufCoiOlB5xdOkqRJdNxMWT7Zi4=
github.com/mattn/go-isatty v0.0.12/go.mod h1:cbi8OIDigv2wuxKPP5vlRcQ1OAZbq2CE4Kysco4FUpU=
github.com/mattn/go-isatty v0.0.14/go.mod h1:7GGIvUiUoEMVVmxf/4nioHXj79iQHKdU27kJ6hsGG94=
github.com/mattn/go-isatty v0.0.16 h1:bq3VjFmv/sOjHtdEhmkEV4x1AJtvUvOJ2PFAZ5+peKQ=
github.com/mattn/go-isatty v0.0.16/go.mod h1:kYGgaQfpe5nmfYZH+SKPsOc2e4SrIfOl2e/yFXSvRLM=
github.com/mattn/go-isatty v0.0.17 h1:BTarxUcIeDqL27Mc+vyvdWYSL28zpIhv3RoTdsLMPng=
github.com/mattn/go-isatty v0.0.17/go.mod h1:kYGgaQfpe5nmfYZH+SKPsOc2e4SrIfOl2e/yFXSvRLM=
github.com/mattn/go-runewidth v0.0.2/go.mod h1:LwmH8dsx7+W8Uxz3IHJYH5QSwggIsqBzpuz5H//U1FU=
github.com/mattn/go-runewidth v0.0.13 h1:lTGmDsbAYt5DmK6OnoV7EuIF1wEIFAcxld6ypU4OSgU=
github.com/mattn/go-runewidth v0.0.13/go.mod h1:Jdepj2loyihRzMpdS35Xk/zdY8IAYHsh153qUoGf23w=
github.com/mattn/go-runewidth v0.0.14 h1:+xnbZSEeDbOIg5/mE6JF0w6n9duR1l3/WmbinWVwUuU=
github.com/mattn/go-runewidth v0.0.14/go.mod h1:Jdepj2loyihRzMpdS35Xk/zdY8IAYHsh153qUoGf23w=
github.com/mattn/go-sqlite3 v1.14.12 h1:TJ1bhYJPV44phC+IMu1u2K/i5RriLTPe+yc68XDJ1Z0=
@@ -283,7 +276,8 @@ github.com/mitchellh/gox v0.4.0/go.mod h1:Sd9lOJ0+aimLBi73mGofS1ycjY8lL3uZM3JPS4
github.com/mitchellh/iochan v1.0.0/go.mod h1:JwYml1nuB7xOzsp52dPpHFffvOCDupsG0QubkSMEySY=
github.com/mitchellh/mapstructure v0.0.0-20160808181253-ca63d7c062ee/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh9fWfEaFds41c1Y=
github.com/mitchellh/mapstructure v1.1.2/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh9fWfEaFds41c1Y=
github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421 h1:ZqeYNhU3OHLH3mGKHDcjJRFFRrJa6eAM5H+CtDdOsPc=
github.com/moby/sys/mountinfo v0.6.2 h1:BzJjoreD5BMFNmD9Rus6gdd1pLuecOFPt8wC+Vygl78=
github.com/moby/sys/mountinfo v0.6.2/go.mod h1:IJb6JQeOklcdMU9F5xQ8ZALD+CUr5VlGpwtX+VE0rpI=
github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q=
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd h1:TRLaZ9cD/w8PVh93nsPXa1VrQ6jlwL5oN8l14QlcNfg=
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q=
@@ -292,6 +286,7 @@ github.com/modern-go/reflect2 v1.0.1/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3Rllmb
github.com/modern-go/reflect2 v1.0.2 h1:xBagoLtFs94CBntxluKeaWgTMpvLxC4ur3nMaC9Gz0M=
github.com/modern-go/reflect2 v1.0.2/go.mod h1:yWuevngMOJpCy52FWWMvUC8ws7m/LJsjYzDa0/r8luk=
github.com/mwitkow/go-conntrack v0.0.0-20161129095857-cc309e4a2223/go.mod h1:qRWi+5nqEBWmkhHvq77mSJWrCKwh8bxhgT7d/eI7P4U=
github.com/mwitkow/go-conntrack v0.0.0-20190716064945-2f068394615f h1:KUppIJq7/+SVif2QVs3tOP0zanoHgBEVAwHxUSIzRqU=
github.com/mwitkow/go-conntrack v0.0.0-20190716064945-2f068394615f/go.mod h1:qRWi+5nqEBWmkhHvq77mSJWrCKwh8bxhgT7d/eI7P4U=
github.com/mwitkow/grpc-proxy v0.0.0-20181017164139-0f1106ef9c76/go.mod h1:x5OoJHDHqxHS801UIuhqGl6QdSAEJvtausosHSdazIo=
github.com/nats-io/jwt v0.3.0/go.mod h1:fRYCDE99xlTsqUzISS1Bi75UBJ6ljOJQOAAu5VglpSg=
@@ -319,14 +314,14 @@ github.com/openzipkin/zipkin-go v0.2.2/go.mod h1:NaW6tEwdmWMaCDZzg8sh+IBNOxHMPnh
github.com/pact-foundation/pact-go v1.0.4/go.mod h1:uExwJY4kCzNPcHRj+hCR/HBbOOIwwtUjcrb0b5/5kLM=
github.com/pascaldekloe/goe v0.0.0-20180627143212-57f6aae5913c/go.mod h1:lzWF7FIEvWOWxwDKqyGYQf6ZUaNfKdP144TG7ZOy1lc=
github.com/pborman/uuid v1.2.0/go.mod h1:X/NO0urCmaxf9VXbdlT7C2Yzkj2IKimNn4k+gtPdI/k=
github.com/pelletier/go-toml/v2 v2.0.1 h1:8e3L2cCQzLFi2CR4g7vGFuFxX7Jl1kKX8gW+iV0GUKU=
github.com/pelletier/go-toml/v2 v2.0.1/go.mod h1:r9LEWfGN8R5k0VXJ+0BkIe7MYkRdwZOjgMj2KwnJFUo=
github.com/pelletier/go-toml/v2 v2.0.6 h1:nrzqCb7j9cDFj2coyLNLaZuJTLjWjlaz6nvTvIwycIU=
github.com/pelletier/go-toml/v2 v2.0.6/go.mod h1:eumQOmlWiOPt5WriQQqoM5y18pDHwha2N+QD+EUNTek=
github.com/performancecopilot/speed v3.0.0+incompatible/go.mod h1:/CLtqpZ5gBg1M9iaPbIdPPGyKcA8hKdoy6hAWba7Yac=
github.com/pierrec/lz4 v1.0.2-0.20190131084431-473cd7ce01a1/go.mod h1:3/3N9NVKO0jef7pBehbT1qWhCMrIgbYNnFAZCqQ5LRc=
github.com/pierrec/lz4 v2.0.5+incompatible/go.mod h1:pdkljMzZIN41W+lC3N2tnIh5sFi+IEE17M5jbnwPHcY=
github.com/pkg/diff v0.0.0-20210226163009-20ebb0f2a09e/go.mod h1:pJLUxLENpZxwdsKMEsNbx1VGcRFpLqf3715MtcvvzbA=
github.com/pkg/errors v0.8.0/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4=
github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
github.com/pkg/profile v1.2.1/go.mod h1:hJw3o1OdXxsrSjjVksARp5W95eeEaEfptyVZyv6JUPA=
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
@@ -355,23 +350,21 @@ github.com/prometheus/procfs v0.0.8/go.mod h1:7Qr8sr6344vo1JqZ6HhLceV9o3AJ1Ff+Gx
github.com/prometheus/procfs v0.1.3/go.mod h1:lV6e/gmhEcM9IjHGsFOCxxuZ+z1YqCvr4OA4YeYWdaU=
github.com/prometheus/procfs v0.3.0/go.mod h1:lV6e/gmhEcM9IjHGsFOCxxuZ+z1YqCvr4OA4YeYWdaU=
github.com/rcrowley/go-metrics v0.0.0-20181016184325-3113b8401b8a/go.mod h1:bCqnVzQkZxMG4s8nGwiZ5l3QUCyqpo9Y+/ZMZ9VjZe4=
github.com/rifflock/lfshook v0.0.0-20180920164130-b9218ef580f5 h1:mZHayPoR0lNmnHyvtYjDeq0zlVHn9K/ZXoy17ylucdo=
github.com/rifflock/lfshook v0.0.0-20180920164130-b9218ef580f5/go.mod h1:GEXHk5HgEKCvEIIrSpFI3ozzG5xOKA2DVlEX/gGnewM=
github.com/rivo/uniseg v0.2.0/go.mod h1:J6wj4VEh+S6ZtnVlnTBMWIodfgj8LQOQFoIToxlJtxc=
github.com/rivo/uniseg v0.4.2 h1:YwD0ulJSJytLpiaWua0sBDusfsCZohxjxzVTYjwxfV8=
github.com/rivo/uniseg v0.4.2/go.mod h1:FN3SvrM+Zdj16jyLfmOkMNblXMcoc8DfTHruCPUcx88=
github.com/rivo/uniseg v0.4.3 h1:utMvzDsuh3suAEnhH0RdHmoPbU648o6CvXxTx4SBMOw=
github.com/rivo/uniseg v0.4.3/go.mod h1:FN3SvrM+Zdj16jyLfmOkMNblXMcoc8DfTHruCPUcx88=
github.com/rogpeppe/fastuuid v0.0.0-20150106093220-6724a57986af/go.mod h1:XWv6SoW27p1b0cqNHllgS5HIMJraePCO15w5zCzIWYg=
github.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4=
github.com/rogpeppe/go-internal v1.6.1/go.mod h1:xXDCJY+GAPziupqXw64V24skbSoqbTEfhy4qGm1nDQc=
github.com/rogpeppe/go-internal v1.8.0 h1:FCbCCtXNOY3UtUuHUYaghJg4y7Fd14rXifAYUAtL9R8=
github.com/rogpeppe/go-internal v1.8.0/go.mod h1:WmiCO8CzOY8rg0OYDC4/i/2WRWAB6poM+XZ2dLUbcbE=
github.com/rs/cors v1.7.0 h1:+88SsELBHx5r+hZ8TCkggzSstaWNbDvThkVK8H6f9ik=
github.com/rs/cors v1.7.0/go.mod h1:gFx+x8UowdsKA9AchylcLynDq+nNFfI8FkUZdN/jGCU=
github.com/russross/blackfriday/v2 v2.0.1/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM=
github.com/ryanuber/columnize v0.0.0-20160712163229-9b3edd62028f/go.mod h1:sm1tb6uqfes/u+d4ooFouqFdy9/2g9QGwK3SQygK0Ts=
github.com/samber/lo v1.38.1 h1:j2XEAqXKb09Am4ebOg31SpvzUTTs6EN3VfgeLUhPdXM=
github.com/samber/lo v1.38.1/go.mod h1:+m/ZKRl6ClXCE2Lgf3MsQlWfh4bn1bz6CXEOxnEXnEA=
github.com/samuel/go-zookeeper v0.0.0-20190923202752-2cc03de413da/go.mod h1:gi+0XIa01GRL2eRQVjQkKGqKF3SF9vZR/HnPullcV2E=
github.com/schollz/progressbar/v3 v3.11.0 h1:3nIBUF1Zw/pGUaRHP7PZWmARP7ZQbWQ6vL6hwoQiIvU=
github.com/schollz/progressbar/v3 v3.11.0/go.mod h1:R2djRgv58sn00AGysc4fN0ip4piOGd3z88K+zVBjczs=
github.com/schollz/progressbar/v3 v3.12.2 h1:yLqqqpQNMxGxHY8uEshRihaHWwa0rf0yb7/Zrpgq2C0=
github.com/schollz/progressbar/v3 v3.12.2/go.mod h1:HFJYIYQQJX32UJdyoigUl19xoV6aMwZt6iX/C30RWfg=
github.com/sean-/seed v0.0.0-20170313163322-e2103e2c3529/go.mod h1:DxrIzT+xaE7yg65j358z/aeFdxmN0P9QXhEzd20vsDc=
@@ -395,20 +388,23 @@ github.com/streadway/handy v0.0.0-20190108123426-d5acb3125c2a/go.mod h1:qNTQ5P5J
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw=
github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo=
github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs=
github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI=
github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4=
github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
github.com/stretchr/testify v1.8.0 h1:pSgiaMZlXftHpm5L7V1+rVB+AZJydKsMxsQBIJw4PKk=
github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU=
github.com/stretchr/testify v1.8.1 h1:w7B6lhMri9wdJUVmEZPGGhZzrYTPvgJArz7wNPgYKsk=
github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4=
github.com/tmc/grpc-websocket-proxy v0.0.0-20170815181823-89b8d40f7ca8/go.mod h1:ncp9v5uamzpCO7NfCPTXjqaC+bZgJeR0sMTm6dMHP7U=
github.com/twitchyliquid64/golang-asm v0.15.1 h1:SU5vSMR7hnwNxj24w34ZyCi/FmDZTkS4MhqMhdFk5YI=
github.com/twitchyliquid64/golang-asm v0.15.1/go.mod h1:a1lVb/DtPvCB8fslRZhAngC2+aY1QWCk3Cedj/Gdt08=
github.com/ugorji/go v1.1.7/go.mod h1:kZn38zHttfInRq0xu/PH0az30d+z6vm202qpg1oXVMw=
github.com/ugorji/go v1.2.7/go.mod h1:nF9osbDWLy6bDVv/Rtoh6QgnvNDpmCalQV5urGCCS6M=
github.com/ugorji/go/codec v1.1.7/go.mod h1:Ax+UKWsSmolVDwsd+7N3ZtXu+yMGCf907BLYF3GoBXY=
github.com/ugorji/go/codec v1.2.7 h1:YPXUKf7fYbp/y8xloBqZOw2qaVggbfwMlI8WM3wZUJ0=
github.com/ugorji/go/codec v1.2.7/go.mod h1:WGN1fab3R1fzQlVQTkfxVtIBhWDRqOviHU95kRgeqEY=
github.com/ugorji/go/codec v1.2.9 h1:rmenucSohSTiyL09Y+l2OCk+FrMxGMzho2+tjr5ticU=
github.com/ugorji/go/codec v1.2.9/go.mod h1:UNopzCgEMSXjBc6AOMqYvWC1ktqTAfzJZUZgYf6w6lg=
github.com/urfave/cli v1.20.0/go.mod h1:70zkFmudgCuE/ngEzBv17Jvp/497gISqfk5gWijbERA=
github.com/urfave/cli v1.22.1/go.mod h1:Gos4lmkARVdJ6EkW0WaNv/tZAAMe9V7XWyB60NtXRu0=
github.com/xiang90/probing v0.0.0-20190116061207-43a291ad63a2/go.mod h1:UETIi67q53MR2AWcXfiuqkDkRtnGDLqkBTpCHuJHxtU=
@@ -425,6 +421,8 @@ go.uber.org/multierr v1.3.0/go.mod h1:VgVr7evmIr6uPjLBxg28wmKNXyqE9akIJ5XnfpiKl+
go.uber.org/tools v0.0.0-20190618225709-2cfd321de3ee/go.mod h1:vJERXedbb3MVM5f9Ejo0C68/HhF8uaILCdgjnY+goOA=
go.uber.org/zap v1.10.0/go.mod h1:vwi/ZaCAaUcBkycHslxD9B2zi4UTXhF60s6SWpuDF0Q=
go.uber.org/zap v1.13.0/go.mod h1:zwrFLgMcdUuIBviXEYEH1YKNaOBnKXsx2IPda5bBwHM=
golang.org/x/arch v0.0.0-20210923205945-b76863e36670 h1:18EFjUmQOcUvxNYSkA6jO9VAiXCnxFY6NyDX0bHDmkU=
golang.org/x/arch v0.0.0-20210923205945-b76863e36670/go.mod h1:5om86z9Hs0C8fWVUuoMHwpExlXzs5Tkyp9hOrfG7pp8=
golang.org/x/crypto v0.0.0-20180904163835-0709b304e793/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4=
golang.org/x/crypto v0.0.0-20181029021203-45a5f77698d3/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4=
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
@@ -432,11 +430,13 @@ golang.org/x/crypto v0.0.0-20190510104115-cbcb75029529/go.mod h1:yigFU9vqHzYiE8U
golang.org/x/crypto v0.0.0-20190701094942-4def268fd1a4/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
golang.org/x/crypto v0.0.0-20210711020723-a769d52b0f97 h1:/UOmuWzQfxxo9UtlXMwuQU8CMgg1eZXqTRwkSQJWKOI=
golang.org/x/crypto v0.0.0-20210711020723-a769d52b0f97/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc=
golang.org/x/crypto v0.5.0 h1:U/0M97KRkSFvyD/3FSmdP5W5swImpNgle/EHFhOsQPE=
golang.org/x/crypto v0.5.0/go.mod h1:NK/OQwhpMQP3MwtdjgLlYHnH9ebylxKWv3e0fK+mkQU=
golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=
golang.org/x/exp v0.0.0-20190306152737-a1d7652674e8/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=
golang.org/x/exp v0.0.0-20200331195152-e8c3332aa8e5/go.mod h1:4M0jN8W1tt0AVLNr8HDosyJCDCDuyL9N9+3m7wDWgKw=
golang.org/x/exp v0.0.0-20220303212507-bbda1eaf7a17 h1:3MTrJm4PyNL9NBqvYDSj3DHl46qQakyfqfWo4jgfaEM=
golang.org/x/exp v0.0.0-20220303212507-bbda1eaf7a17/go.mod h1:lgLbSvA5ygNOMpwM/9anMpWVlVJ7Z+cHWq/eFuinpGE=
golang.org/x/image v0.0.0-20190227222117-0694c2d4d067/go.mod h1:kZ7UVZpmo3dzQBMxlp+ypCbDeSB+sBbTgSJuh5dn5js=
golang.org/x/image v0.0.0-20190802002840-cff245a6509b/go.mod h1:FeLwcggjj3mMvU+oOTbSwawSJRM1uh48EjtB4UJZlP0=
golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE=
@@ -466,12 +466,10 @@ golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLL
golang.org/x/net v0.0.0-20190813141303-74dc4d7220e7/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
golang.org/x/net v0.0.0-20200421231249-e086a090c8fd/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A=
golang.org/x/net v0.0.0-20200625001655-4c5254603344/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA=
golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg=
golang.org/x/net v0.0.0-20210805182204-aaa1db679c0d/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y=
golang.org/x/net v0.0.0-20220127200216-cd36cc0744dd h1:O7DYs+zxREGLKzKoMQrtrEacpb0ZVXA5rIwylE2Xchk=
golang.org/x/net v0.0.0-20220127200216-cd36cc0744dd/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk=
golang.org/x/net v0.0.0-20220722155237-a158d28d115b h1:PxfKdU9lEEDYjdIzOtC4qFWgkU2rGHdKlKowJSMN9h0=
golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c=
golang.org/x/net v0.8.0 h1:Zrh2ngAOFYneWTAIAPethzeaQLuHwhuBkuV6ZiRnUaQ=
golang.org/x/net v0.8.0/go.mod h1:QVkue5JL9kW//ek3r6jTKnTFis1tRmNAW2P1shuFdJc=
golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U=
golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw=
golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
@@ -505,34 +503,29 @@ golang.org/x/sys v0.0.0-20200420163511-1957bb5e6d1f/go.mod h1:h1NjWce9XRLGQEsW7w
golang.org/x/sys v0.0.0-20200615200032-f1bc736245b1/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20200625212154-ddb9806d33ae/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20210320140829-1e4c9ba3b0c4/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20210630005230-0f9fa26af87c/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20210806184541-e5e7981a1069/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20210809222454-d867a43fc93e/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20211216021012-1d35b9e2eb4e/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20220704084225-05e143d24a9e/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20220715151400-c0bba94af5f8/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20220829200755-d48e67d00261/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20220913175220-63ea55921009 h1:PuvuRMeLWqsf/ZdT1UUZz0syhioyv1mzuFZsXs4fvhw=
golang.org/x/sys v0.0.0-20220913175220-63ea55921009/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.3.0 h1:w8ZOecv6NaNa/zC8944JTU3vz4u6Lagfk4RPQxv92NQ=
golang.org/x/sys v0.3.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.6.0 h1:MVltZSvRTcU2ljQOhs94SXPftV6DCNnZViHeQps87pQ=
golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8=
golang.org/x/term v0.0.0-20220722155259-a9ba230a4035 h1:Q5284mrmYTpACcm+eAKjKJH48BBwSyfJqmmGDTtT8Vc=
golang.org/x/term v0.0.0-20220722155259-a9ba230a4035/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8=
golang.org/x/term v0.3.0 h1:qoo4akIqOcDME5bhc/NgxUdovd6BSS2uMsVjB56q1xI=
golang.org/x/term v0.3.0/go.mod h1:q750SLmJuPmVoN1blW3UFBPREJfb1KmY3vwxfr+nFDA=
golang.org/x/term v0.6.0 h1:clScbb1cHjoCkyRbWwBEUZ5H/tIFu5TAXIqaZD0Gcjw=
golang.org/x/term v0.6.0/go.mod h1:m6U89DPEgQRMq3DNkDClhWw02AUbt2daBVO4cn4Hv9U=
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk=
golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
golang.org/x/text v0.3.7 h1:olpwvP2KacW1ZWvsR7uQhoyTYvKAupfQrRGBFM352Gk=
golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ=
golang.org/x/text v0.4.0 h1:BrVqGRd7+k1DiOgtnFvAkoQEWQvBc25ouMJM6429SFg=
golang.org/x/text v0.4.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8=
golang.org/x/text v0.8.0 h1:57P1ETyNKtuIjB4SRd15iJxuhj8Gc416Y78H3qgMh68=
golang.org/x/text v0.8.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8=
golang.org/x/time v0.0.0-20180412165947-fbb02b2291d2/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
golang.org/x/time v0.0.0-20191024005414-555d28b269f0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
golang.org/x/tools v0.0.0-20180221164845-07fd8470d635/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
@@ -551,7 +544,6 @@ golang.org/x/tools v0.0.0-20200103221440-774c71fcf114/go.mod h1:TB2adYChydJhpapK
golang.org/x/tools v0.0.0-20200207183749-b753a1ba74fa/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28=
golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543 h1:E7g+9GITq07hpfrRu66IVDexMakfv52eLZ2CXBWiKr4=
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
google.golang.org/api v0.3.1/go.mod h1:6wY9I6uQWHQ8EM57III9mq/AjF+i8G65rmVagqKMtkk=
@@ -564,10 +556,10 @@ google.golang.org/genproto v0.0.0-20190425155659-357c62f0e4bb/go.mod h1:VzzqZJRn
google.golang.org/genproto v0.0.0-20190530194941-fb225487d101/go.mod h1:z3L6/3dTEVtUr6QSP8miRzeRqwQOioJ9I66odjN4I7s=
google.golang.org/genproto v0.0.0-20190819201941-24fa4b261c55/go.mod h1:DMBHOl98Agz4BDEuKkezgsaosCRResVns1a3J2ZsMNc=
google.golang.org/genproto v0.0.0-20200423170343-7949de9c1215/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c=
google.golang.org/genproto v0.0.0-20200526211855-cb27e3aa2013 h1:+kGHl1aib/qcwaRi1CbqBZ1rk19r85MNUf8HaBghugY=
google.golang.org/genproto v0.0.0-20200526211855-cb27e3aa2013/go.mod h1:NbSheEEYHJ7i3ixzK3sjbqSGDJWnxyFXZblF3eUsNvo=
google.golang.org/genproto v0.0.0-20210126160654-44e461bb6506 h1:uLBY0yHDCj2PMQ98KWDSIDFwn9zK2zh+tgWtbvPPBjI=
google.golang.org/genproto v0.0.0-20210126160654-44e461bb6506/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no=
google.golang.org/genproto v0.0.0-20230110181048-76db0878b65f h1:BWUVssLB0HVOSY78gIdvk1dTVYtT1y8SBWtPYuTJ/6w=
google.golang.org/genproto v0.0.0-20230110181048-76db0878b65f/go.mod h1:RGgjbofJ8xD9Sq1VVhDM1Vok1vRONV+rg+CjzG4SZKM=
google.golang.org/grpc v1.17.0/go.mod h1:6QZJwpn2B+Zp71q/5VxRsJ6NXXVCE5NRUHRo+f3cWCs=
google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c=
google.golang.org/grpc v1.20.0/go.mod h1:chYK+tFQF0nDUGJgXMSgLCQk3phJEuONr2DCgLDdAQM=
@@ -581,8 +573,8 @@ google.golang.org/grpc v1.26.0/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8
google.golang.org/grpc v1.27.0/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk=
google.golang.org/grpc v1.29.1/go.mod h1:itym6AZVZYACWQqET3MqgPpjcuV5QH3BxFS3IjizoKk=
google.golang.org/grpc v1.32.0/go.mod h1:N36X2cJ7JwdamYAgDz+s+rVMFjt3numwzf/HckM8pak=
google.golang.org/grpc v1.51.0 h1:E1eGv1FTqoLIdnBCZufiSHgKjlqG6fKFf6pPWtMTh8U=
google.golang.org/grpc v1.51.0/go.mod h1:wgNDFcnuBGmxLKI/qn4T+m5BtEBYXJPvibbUPsAIPww=
google.golang.org/grpc v1.53.0 h1:LAv2ds7cmFV/XTS3XG1NneeENYrXGmorPxsBbptIjNc=
google.golang.org/grpc v1.53.0/go.mod h1:OnIrk0ipVdj4N5d9IUoFUx72/VlD7+jUsHwZgwSMQpw=
google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8=
google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0=
google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM=
@@ -595,14 +587,13 @@ google.golang.org/protobuf v1.24.0/go.mod h1:r/3tXBNzIEhYS9I1OUVjXDlt8tc493IdKGj
google.golang.org/protobuf v1.25.0/go.mod h1:9JNX74DMeImyA3h4bdi1ymwjUzf21/xIlbajtzgsN7c=
google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw=
google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc=
google.golang.org/protobuf v1.28.0 h1:w43yiav+6bVFTBQFZX0r7ipe9JQ1QsbMgHwbBziscLw=
google.golang.org/protobuf v1.28.0/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I=
google.golang.org/protobuf v1.30.0 h1:kPPoIgf3TsEvrm0PFe15JQ+570QVxYzEvvHqChK+cng=
google.golang.org/protobuf v1.30.0/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I=
gopkg.in/alecthomas/kingpin.v2 v2.2.6/go.mod h1:FMv+mEhP44yOT+4EoQTLFTRgOQ1FBLkstjWtayDeSgw=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk=
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q=
gopkg.in/cheggaaa/pb.v1 v1.0.25/go.mod h1:V/YB90LKu/1FcN3WVnfiiE5oMCibMjukxqG/qStrOgw=
gopkg.in/errgo.v2 v2.1.0/go.mod h1:hNsd1EY+bozCKY1Ytp96fpM3vjJbqLJn88ws8XvfDNI=
gopkg.in/fsnotify.v1 v1.4.7/go.mod h1:Tz8NjZHkW78fSQdbUxIjBTcgA1z1m8ZHf0WmKUhAMys=
@@ -636,5 +627,6 @@ honnef.co/go/tools v0.0.0-20190523083050-ea95bdfd59fc/go.mod h1:rf3lG4BRIbNafJWh
honnef.co/go/tools v0.0.1-2019.2.3/go.mod h1:a3bituU0lyd329TUQxRnasdCoJDkEUEAqEt0JzvZhAg=
nhooyr.io/websocket v1.8.6 h1:s+C3xAMLwGmlI31Nyn/eAehUlZPwfYZu2JXM621Q5/k=
nhooyr.io/websocket v1.8.6/go.mod h1:B70DZP8IakI65RVQ51MsWP/8jndNma26DVA/nFSCgW0=
rsc.io/pdf v0.1.1/go.mod h1:n8OzWcQ6Sp37PL01nO98y4iUCRdTGarVfzxY20ICaU4=
sigs.k8s.io/yaml v1.1.0/go.mod h1:UJmg0vDUVViEyp3mgSv9WPwZCDxu4rQW1olrI1uml+o=
sourcegraph.com/sourcegraph/appdash v0.0.0-20190731080439-ebfcffb1b5c0/go.mod h1:hI742Nqp5OhwiqlzhgfbWU4mW4yO10fP+LoT9WOswdU=
+98
View File
@@ -1,6 +1,13 @@
package library
import (
"context"
"encoding/json"
"fmt"
"github.com/abc950309/tapewriter/entity"
"github.com/modern-go/reflect2"
"github.com/samber/lo"
"gorm.io/gorm"
)
@@ -19,3 +26,94 @@ func New(db *gorm.DB) *Library {
func (l *Library) AutoMigrate() error {
return l.db.AutoMigrate(ModelFile, ModelPosition, ModelTape)
}
type ExportLibrary struct {
Files *[]*File `json:"files,omitempty"`
Tapes *[]*Tape `json:"tapes,omitempty"`
Positions *[]*Position `json:"positions,omitempty"`
}
func (l *Library) Export(ctx context.Context, types []entity.LibraryEntityType) ([]byte, error) {
results := new(ExportLibrary)
for _, t := range lo.Uniq(types) {
switch t {
case entity.LibraryEntityType_FILE:
files, err := listAll(ctx, l, make([]*File, 0, batchSize))
if err != nil {
return nil, fmt.Errorf("list all files fail, %w", err)
}
results.Files = &files
case entity.LibraryEntityType_TAPE:
tapes, err := listAll(ctx, l, make([]*Tape, 0, batchSize))
if err != nil {
return nil, fmt.Errorf("list all tapes fail, %w", err)
}
results.Tapes = &tapes
case entity.LibraryEntityType_POSITION:
positions, err := listAll(ctx, l, make([]*Position, 0, batchSize))
if err != nil {
return nil, fmt.Errorf("list all positions fail, %w", err)
}
results.Positions = &positions
}
}
return json.Marshal(results)
}
func (l *Library) Import(ctx context.Context, buf []byte) error {
results := new(ExportLibrary)
if err := json.Unmarshal(buf, results); err != nil {
return fmt.Errorf("unmarshal import data fail, %w", err)
}
if results.Files != nil {
if r := l.db.WithContext(ctx).Session(&gorm.Session{AllowGlobalUpdate: true}).Delete(ModelFile); r.Error != nil {
return fmt.Errorf("cleanup file fail, %w", r.Error)
}
if r := l.db.WithContext(ctx).CreateInBatches(*results.Files, 100); r.Error != nil {
return fmt.Errorf("insert file fail, %w", r.Error)
}
}
if results.Tapes != nil {
if r := l.db.WithContext(ctx).Session(&gorm.Session{AllowGlobalUpdate: true}).Delete(ModelTape); r.Error != nil {
return fmt.Errorf("cleanup tape fail, %w", r.Error)
}
if r := l.db.WithContext(ctx).CreateInBatches(*results.Tapes, 100); r.Error != nil {
return fmt.Errorf("insert tape fail, %w", r.Error)
}
}
if results.Positions != nil {
if r := l.db.WithContext(ctx).Session(&gorm.Session{AllowGlobalUpdate: true}).Delete(ModelPosition); r.Error != nil {
return fmt.Errorf("cleanup position fail, %w", r.Error)
}
if r := l.db.WithContext(ctx).CreateInBatches(*results.Positions, 100); r.Error != nil {
return fmt.Errorf("insert position fail, %w", r.Error)
}
}
return nil
}
func listAll[T any](ctx context.Context, l *Library, items []T) ([]T, error) {
v := new(T)
id := reflect2.TypeOfPtr(*v).Elem().(reflect2.StructType).FieldByName("ID")
var cursor int64
for {
batch := make([]T, 0, batchSize)
if r := l.db.WithContext(ctx).Where("id > ?", cursor).Order("id ASC").Limit(batchSize).Find(&batch); r.Error != nil {
return nil, fmt.Errorf("list files fail, cursor= %d, %w", cursor, r.Error)
}
if len(batch) == 0 {
return items, nil
}
c := id.Get(batch[len(batch)-1]).(*int64)
cursor = *c
items = append(items, batch...)
}
}
+3 -5
View File
@@ -4,8 +4,6 @@ import (
"context"
"fmt"
"time"
"gorm.io/gorm"
)
var (
@@ -26,20 +24,20 @@ type Position struct {
}
func (l *Library) GetPositionByFileID(ctx context.Context, fileID int64) ([]*Position, error) {
results, err := l.MGetPositionByFileID(ctx, l.db.WithContext(ctx), fileID)
results, err := l.MGetPositionByFileID(ctx, fileID)
if err != nil {
panic(err)
}
return results[fileID], nil
}
func (l *Library) MGetPositionByFileID(ctx context.Context, tx *gorm.DB, fileIDs ...int64) (map[int64][]*Position, error) {
func (l *Library) MGetPositionByFileID(ctx context.Context, fileIDs ...int64) (map[int64][]*Position, error) {
if len(fileIDs) == 0 {
return map[int64][]*Position{}, nil
}
positions := make([]*Position, 0, len(fileIDs))
if r := tx.Where("file_id IN (?)", fileIDs).Find(&positions); r.Error != nil {
if r := l.db.WithContext(ctx).Where("file_id IN (?)", fileIDs).Find(&positions); r.Error != nil {
return nil, fmt.Errorf("find position by file id fail, %w", r.Error)
}
+31
View File
@@ -5,6 +5,8 @@ import (
"fmt"
"os"
"time"
"github.com/abc950309/tapewriter/entity"
)
var (
@@ -78,6 +80,35 @@ func (l *Library) GetTape(ctx context.Context, id int64) (*Tape, error) {
return tape, nil
}
func (l *Library) DeleteTapes(ctx context.Context, ids ...int64) error {
if r := l.db.WithContext(ctx).Where("id IN (?)", ids).Delete(ModelTape); r.Error != nil {
return fmt.Errorf("delete tapes fail, err= %w", r.Error)
}
return nil
}
func (l *Library) ListTape(ctx context.Context, filter *entity.TapeFilter) ([]*Tape, error) {
db := l.db.WithContext(ctx)
if filter.Limit != nil {
db = db.Limit(int(*filter.Limit))
} else {
db = db.Limit(20)
}
if filter.Offset != nil {
db = db.Offset(int(*filter.Offset))
}
db = db.Order("create_time DESC")
tapes := make([]*Tape, 0, 20)
if r := db.Find(&tapes); r.Error != nil {
return nil, fmt.Errorf("list tapes fail, err= %w", r.Error)
}
return tapes, nil
}
func (l *Library) MGetTape(ctx context.Context, tapeIDs ...int64) (map[int64]*Tape, error) {
if len(tapeIDs) == 0 {
return map[int64]*Tape{}, nil
+7
View File
@@ -0,0 +1,7 @@
#!/usr/bin/env bash
set -ex;
# SG_DEVICE=`sg_map | grep ${DEVICE} | awk '{print $1}'`
BARCODE=`./lto-info -f /dev/nst0 | grep 'Barcode' | awk '{print $3}'`
echo "{\"barcode\": \"$BARCODE\"}" > $OUT
sleep 3
+15
View File
@@ -0,0 +1,15 @@
package tools
func Cache[i comparable, o any](f func(in i) o) func(in i) o {
cache := make(map[i]o, 0)
return func(in i) o {
cached, has := cache[in]
if has {
return cached
}
out := f(in)
cache[in] = out
return out
}
}