Skip to content

Commit

Permalink
feat: add tapes index view
Browse files Browse the repository at this point in the history
  • Loading branch information
samuelncui committed Oct 3, 2023
1 parent 15079aa commit 999b9bf
Show file tree
Hide file tree
Showing 27 changed files with 1,357 additions and 358 deletions.
2 changes: 0 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,7 @@ Or you can download binary from `releases`, and run the following shell commands

```shell
# If you put this to other path, you need to change scripts and systemd service file.
mkdir -p /opt/ltfs
mkdir -p /opt/yatm

tar -xvzf yatm-linux-amd64-${RELEASE_VERSION}.tar.gz -C /opt/yatm

cp /opt/yatm/config.example.yaml /opt/yatm/config.yaml
Expand Down
14 changes: 14 additions & 0 deletions apis/library_trim.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
package apis

import (
"context"

"github.com/samuelncui/yatm/entity"
)

func (api *API) LibraryTrim(ctx context.Context, req *entity.LibraryTrimRequest) (*entity.LibraryTrimReply, error) {
if err := api.lib.Trim(ctx, req.TrimPosition, req.TrimFile); err != nil {
return nil, err
}
return &entity.LibraryTrimReply{}, nil
}
17 changes: 17 additions & 0 deletions apis/tape_get_positions.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
package apis

import (
"context"
"fmt"

"github.com/samuelncui/yatm/entity"
)

func (api *API) TapeGetPositions(ctx context.Context, req *entity.TapeGetPositionsRequest) (*entity.TapeGetPositionsReply, error) {
positions, err := api.lib.ListPositions(ctx, req.Id, req.Directory)
if err != nil {
return nil, fmt.Errorf("list position has error, %w", err)
}

return &entity.TapeGetPositionsReply{Positions: convertPositions(positions...)}, nil
}
3 changes: 2 additions & 1 deletion build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ export TARGET_FILE="yatm-linux-amd64-${RELEASE_VERSION}.tar.gz"

rm -rf output;
mkdir -p output;
mkdir -p output/captured_indices;

cp -r scripts ./output/;
cp ./cmd/httpd/yatm-httpd.service ./output/
Expand All @@ -16,7 +17,7 @@ cp ./LICENSE ./output/
cp ./README.md ./output/
echo "${RELEASE_VERSION}" > ./output/VERSION

# docker run --rm -v $(pwd):/app golang:1.21 sh -c "cd /app && bash "
# docker run --rm -v $(pwd):/app golang:1.21 sh -c "cd /app && bash build_backend.sh"
# docker run --rm -v $(pwd):/app node:20-slim sh -c "cd /app && bash build_frontend.sh"
./build_backend.sh
./build_frontend.sh
Expand Down
Loading

0 comments on commit 999b9bf

Please sign in to comment.