mirror of
https://github.com/wavetermdev/backup.git
synced 2026-08-05 13:57:07 -07:00
cmd blocks (#74)
This commit is contained in:
@@ -8,6 +8,7 @@ import (
|
||||
"fmt"
|
||||
"time"
|
||||
|
||||
"github.com/wavetermdev/thenextwave/pkg/blockcontroller"
|
||||
"github.com/wavetermdev/thenextwave/pkg/cmdqueue"
|
||||
"github.com/wavetermdev/thenextwave/pkg/filestore"
|
||||
"github.com/wavetermdev/thenextwave/pkg/tsgen/tsgenmeta"
|
||||
@@ -28,6 +29,17 @@ func (bs *BlockService) SendCommand_Meta() tsgenmeta.MethodMeta {
|
||||
}
|
||||
}
|
||||
|
||||
func (bs *BlockService) GetControllerStatus(ctx context.Context, blockId string) (*blockcontroller.BlockControllerRuntimeStatus, error) {
|
||||
bc := blockcontroller.GetBlockController(blockId)
|
||||
if bc == nil {
|
||||
return &blockcontroller.BlockControllerRuntimeStatus{
|
||||
BlockId: blockId,
|
||||
Status: "stopped",
|
||||
}, nil
|
||||
}
|
||||
return bc.GetRuntimeStatus(), nil
|
||||
}
|
||||
|
||||
func (bs *BlockService) SendCommand(uiContext wstore.UIContext, blockId string, cmd wshutil.BlockCommand) error {
|
||||
ctx, cancelFn := context.WithTimeout(context.Background(), DefaultTimeout)
|
||||
defer cancelFn()
|
||||
|
||||
@@ -76,9 +76,8 @@ func (fs *FileService) ReadFile(path string) (*FullFile, error) {
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("unable to parse directory %s", finfo.Path)
|
||||
}
|
||||
|
||||
if len(innerFilesEntries) > 1000 {
|
||||
innerFilesEntries = innerFilesEntries[:1001]
|
||||
innerFilesEntries = innerFilesEntries[:1000]
|
||||
}
|
||||
var innerFilesInfo []FileInfo
|
||||
for _, innerFileEntry := range innerFilesEntries {
|
||||
|
||||
Reference in New Issue
Block a user