(ctx context.Context, data wshrpc.CommandDebugTermData)
| 834 | } |
| 835 | |
| 836 | func (ws *WshServer) DebugTermCommand(ctx context.Context, data wshrpc.CommandDebugTermData) (*wshrpc.CommandDebugTermRtnData, error) { |
| 837 | if data.BlockId == "" { |
| 838 | return nil, fmt.Errorf("blockid is required") |
| 839 | } |
| 840 | if data.Size <= 0 { |
| 841 | return nil, fmt.Errorf("size must be greater than 0") |
| 842 | } |
| 843 | waveFile, err := filestore.WFS.Stat(ctx, data.BlockId, wavebase.BlockFile_Term) |
| 844 | if err == fs.ErrNotExist { |
| 845 | return &wshrpc.CommandDebugTermRtnData{}, nil |
| 846 | } |
| 847 | if err != nil { |
| 848 | return nil, fmt.Errorf("error statting term file: %w", err) |
| 849 | } |
| 850 | readSize := data.Size |
| 851 | dataLength := waveFile.DataLength() |
| 852 | if readSize > dataLength { |
| 853 | readSize = dataLength |
| 854 | } |
| 855 | readOffset := waveFile.Size - readSize |
| 856 | readOffset, readData, err := filestore.WFS.ReadAt(ctx, data.BlockId, wavebase.BlockFile_Term, readOffset, readSize) |
| 857 | if err != nil { |
| 858 | return nil, fmt.Errorf("error reading term file: %w", err) |
| 859 | } |
| 860 | return &wshrpc.CommandDebugTermRtnData{ |
| 861 | Offset: readOffset, |
| 862 | Data64: base64.StdEncoding.EncodeToString(readData), |
| 863 | }, nil |
| 864 | } |
| 865 | |
| 866 | func (ws *WshServer) WaveInfoCommand(ctx context.Context) (*wshrpc.WaveInfoData, error) { |
| 867 | return &wshrpc.WaveInfoData{ |
nothing calls this directly
no test coverage detected