forked from TrueCloudLab/frostfs-sdk-go
[#XX] pool/tree: Add new burned methods
Signed-off-by: Denis Kirillov <d.kirillov@yadro.com>
This commit is contained in:
parent
12ddefe078
commit
0ee3fcc18f
6 changed files with 3485 additions and 601 deletions
2
go.sum
2
go.sum
|
@ -31,8 +31,6 @@ cloud.google.com/go/storage v1.6.0/go.mod h1:N7U0C8pVQ/+NIKOBQyamJIeKQKkZ+mxpohl
|
|||
cloud.google.com/go/storage v1.8.0/go.mod h1:Wv1Oy7z6Yz3DshWRJFhqM/UCfaWIRTdp0RXyy7KQOVs=
|
||||
cloud.google.com/go/storage v1.10.0/go.mod h1:FLPqc6j+Ki4BU591ie1oL6qBQGu2Bl/tZ9ullr3+Kg0=
|
||||
dmitri.shuralyov.com/gpu/mtl v0.0.0-20190408044501-666a987793e9/go.mod h1:H6x//7gZCb22OMCxBHrMx7a5I7Hp++hsVxbQ4BYO7hU=
|
||||
git.frostfs.info/TrueCloudLab/frostfs-api-go/v2 v2.16.1-0.20240422151450-df9b65324a4c h1:RFDrNsF2e+EJfaB8lZrRRxNjQkLfM09gnEyudvGuc10=
|
||||
git.frostfs.info/TrueCloudLab/frostfs-api-go/v2 v2.16.1-0.20240422151450-df9b65324a4c/go.mod h1:OBDSr+DqV1z4VDouoX3YMleNc4DPBVBWTG3WDT2PK1o=
|
||||
git.frostfs.info/TrueCloudLab/frostfs-api-go/v2 v2.16.1-0.20240427200446-67c6f305b21f h1:YyjsQNtrngQzIKOUtApXoi5r5pewatM+cXfpY19vZWo=
|
||||
git.frostfs.info/TrueCloudLab/frostfs-api-go/v2 v2.16.1-0.20240427200446-67c6f305b21f/go.mod h1:OBDSr+DqV1z4VDouoX3YMleNc4DPBVBWTG3WDT2PK1o=
|
||||
git.frostfs.info/TrueCloudLab/frostfs-contract v0.0.0-20230307110621-19a8ef2d02fb h1:S/TrbOOu9qEXZRZ9/Ddw7crnxbBUQLo68PSzQWYrc9M=
|
||||
|
|
|
@ -169,6 +169,55 @@ type RemoveNodeParams struct {
|
|||
BearerToken []byte
|
||||
}
|
||||
|
||||
// BurnedAddParams groups parameters of Pool.BurnedAdd operation.
|
||||
type BurnedAddParams struct {
|
||||
CID cid.ID
|
||||
TreeID string
|
||||
Key string
|
||||
Meta map[string]string
|
||||
BearerToken []byte
|
||||
}
|
||||
|
||||
// BurnedRemoveParams groups parameters of Pool.BurnedRemove operation.
|
||||
type BurnedRemoveParams struct {
|
||||
CID cid.ID
|
||||
TreeID string
|
||||
Key string
|
||||
BearerToken []byte
|
||||
}
|
||||
|
||||
// BurnedGetParams groups parameters of Pool.BurnedGet operation.
|
||||
type BurnedGetParams struct {
|
||||
CID cid.ID
|
||||
TreeID string
|
||||
Key string
|
||||
BearerToken []byte
|
||||
}
|
||||
|
||||
// BurnedGetLatestByPrefixParams groups parameters of Pool.GetLatestByPrefix operation.
|
||||
type BurnedGetLatestByPrefixParams struct {
|
||||
CID cid.ID
|
||||
TreeID string
|
||||
Prefix string
|
||||
BearerToken []byte
|
||||
}
|
||||
|
||||
// BurnedListParams groups parameters of Pool.BurnedList operation.
|
||||
type BurnedListParams struct {
|
||||
CID cid.ID
|
||||
TreeID string
|
||||
Start string
|
||||
BearerToken []byte
|
||||
}
|
||||
|
||||
// BurnedListByPrefixParams groups parameters of Pool.BurnedListByPrefix operation.
|
||||
type BurnedListByPrefixParams struct {
|
||||
CID cid.ID
|
||||
TreeID string
|
||||
Prefix string
|
||||
BearerToken []byte
|
||||
}
|
||||
|
||||
// NewPool creates connection pool using parameters.
|
||||
func NewPool(options InitParameters) (*Pool, error) {
|
||||
if options.key == nil {
|
||||
|
@ -575,6 +624,276 @@ func (p *Pool) RemoveNode(ctx context.Context, prm RemoveNodeParams) error {
|
|||
})
|
||||
}
|
||||
|
||||
// BurnedAdd invokes eponymous method from TreeServiceClient.
|
||||
//
|
||||
// Can return predefined errors:
|
||||
// * ErrNodeNotFound
|
||||
// * ErrNodeAccessDenied.
|
||||
func (p *Pool) BurnedAdd(ctx context.Context, prm BurnedAddParams) (*grpcService.BurnedAddResponse_Body, error) {
|
||||
request := &grpcService.BurnedAddRequest{
|
||||
Body: &grpcService.BurnedAddRequest_Body{
|
||||
ContainerId: prm.CID[:],
|
||||
TreeId: prm.TreeID,
|
||||
Key: prm.Key,
|
||||
Meta: metaToKV(prm.Meta),
|
||||
},
|
||||
}
|
||||
|
||||
if err := p.signRequest(request.Body, func(key, sign []byte) {
|
||||
request.Signature = &grpcService.Signature{
|
||||
Key: key,
|
||||
Sign: sign,
|
||||
}
|
||||
}); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
var resp *grpcService.BurnedAddResponse
|
||||
if err := p.requestWithRetry(ctx, func(client grpcService.TreeServiceClient) (inErr error) {
|
||||
resp, inErr = client.BurnedAdd(ctx, request)
|
||||
return handleError("failed to burned add node by path", inErr)
|
||||
}); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
body := resp.GetBody()
|
||||
if body == nil {
|
||||
return nil, errors.New("nil body in tree service response")
|
||||
}
|
||||
|
||||
return body, nil
|
||||
}
|
||||
|
||||
// BurnedRemove invokes eponymous method from TreeServiceClient.
|
||||
//
|
||||
// Can return predefined errors:
|
||||
// * ErrNodeNotFound
|
||||
// * ErrNodeAccessDenied.
|
||||
func (p *Pool) BurnedRemove(ctx context.Context, prm BurnedRemoveParams) error {
|
||||
request := &grpcService.BurnedRemoveRequest{
|
||||
Body: &grpcService.BurnedRemoveRequest_Body{
|
||||
ContainerId: prm.CID[:],
|
||||
TreeId: prm.TreeID,
|
||||
Key: prm.Key,
|
||||
},
|
||||
}
|
||||
if err := p.signRequest(request.Body, func(key, sign []byte) {
|
||||
request.Signature = &grpcService.Signature{
|
||||
Key: key,
|
||||
Sign: sign,
|
||||
}
|
||||
}); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
return p.requestWithRetry(ctx, func(client grpcService.TreeServiceClient) error {
|
||||
if _, err := client.BurnedRemove(ctx, request); err != nil {
|
||||
return handleError("failed to burned remove node", err)
|
||||
}
|
||||
return nil
|
||||
})
|
||||
}
|
||||
|
||||
// BurnedGet invokes eponymous method from TreeServiceClient.
|
||||
//
|
||||
// Can return predefined errors:
|
||||
// * ErrNodeNotFound
|
||||
// * ErrNodeAccessDenied.
|
||||
func (p *Pool) BurnedGet(ctx context.Context, prm BurnedGetParams) (*grpcService.BurnedGetResponse_Body, error) {
|
||||
request := &grpcService.BurnedGetRequest{
|
||||
Body: &grpcService.BurnedGetRequest_Body{
|
||||
ContainerId: prm.CID[:],
|
||||
TreeId: prm.TreeID,
|
||||
Key: prm.Key,
|
||||
BearerToken: prm.BearerToken,
|
||||
},
|
||||
}
|
||||
if err := p.signRequest(request.Body, func(key, sign []byte) {
|
||||
request.Signature = &grpcService.Signature{
|
||||
Key: key,
|
||||
Sign: sign,
|
||||
}
|
||||
}); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
var resp *grpcService.BurnedGetResponse
|
||||
if err := p.requestWithRetry(ctx, func(client grpcService.TreeServiceClient) (inErr error) {
|
||||
resp, inErr = client.BurnedGet(ctx, request)
|
||||
return handleError("failed to burned get node", inErr)
|
||||
}); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
body := resp.GetBody()
|
||||
if body == nil {
|
||||
return nil, errors.New("nil body in tree service response")
|
||||
}
|
||||
return body, nil
|
||||
}
|
||||
|
||||
// BurnedGetLatestByPrefix invokes eponymous method from TreeServiceClient.
|
||||
//
|
||||
// Can return predefined errors:
|
||||
// * ErrNodeNotFound
|
||||
// * ErrNodeAccessDenied.
|
||||
func (p *Pool) BurnedGetLatestByPrefix(ctx context.Context, prm BurnedGetLatestByPrefixParams) (*grpcService.BurnedGetLatestByPrefixResponse_Body, error) {
|
||||
request := &grpcService.BurnedGetLatestByPrefixRequest{
|
||||
Body: &grpcService.BurnedGetLatestByPrefixRequest_Body{
|
||||
ContainerId: prm.CID[:],
|
||||
TreeId: prm.TreeID,
|
||||
Prefix: prm.Prefix,
|
||||
BearerToken: prm.BearerToken,
|
||||
},
|
||||
}
|
||||
if err := p.signRequest(request.Body, func(key, sign []byte) {
|
||||
request.Signature = &grpcService.Signature{
|
||||
Key: key,
|
||||
Sign: sign,
|
||||
}
|
||||
}); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
var resp *grpcService.BurnedGetLatestByPrefixResponse
|
||||
if err := p.requestWithRetry(ctx, func(client grpcService.TreeServiceClient) (inErr error) {
|
||||
resp, inErr = client.BurnedGetLatestByPrefix(ctx, request)
|
||||
return handleError("failed to burned get latest by prefix", inErr)
|
||||
}); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
body := resp.GetBody()
|
||||
if body == nil {
|
||||
return nil, errors.New("nil body in tree service response")
|
||||
}
|
||||
return body, nil
|
||||
}
|
||||
|
||||
// BurnedListReader is designed to read list of subtree nodes FrostFS tree service.
|
||||
//
|
||||
// Must be initialized using Pool.BurnedList, any other usage is unsafe.
|
||||
type BurnedListReader struct {
|
||||
cli grpcService.TreeService_BurnedListClient
|
||||
}
|
||||
|
||||
// Read reads another list of the subtree nodes.
|
||||
func (x *BurnedListReader) Read(buf []*grpcService.BurnedListResponse_Body) (int, error) {
|
||||
for i := 0; i < len(buf); i++ {
|
||||
resp, err := x.cli.Recv()
|
||||
if err == io.EOF {
|
||||
return i, io.EOF
|
||||
} else if err != nil {
|
||||
return i, handleError("failed to get sub tree", err)
|
||||
}
|
||||
buf[i] = resp.Body
|
||||
}
|
||||
|
||||
return len(buf), nil
|
||||
}
|
||||
|
||||
// ReadAll reads all nodes subtree nodes.
|
||||
func (x *BurnedListReader) ReadAll() ([]*grpcService.BurnedListResponse_Body, error) {
|
||||
var res []*grpcService.BurnedListResponse_Body
|
||||
for {
|
||||
resp, err := x.cli.Recv()
|
||||
if err == io.EOF {
|
||||
break
|
||||
} else if err != nil {
|
||||
return nil, handleError("failed to get sub tree", err)
|
||||
}
|
||||
res = append(res, resp.Body)
|
||||
}
|
||||
|
||||
return res, nil
|
||||
}
|
||||
|
||||
// Next gets the next node from subtree.
|
||||
func (x *BurnedListReader) Next() (*grpcService.BurnedListResponse_Body, error) {
|
||||
resp, err := x.cli.Recv()
|
||||
if err == io.EOF {
|
||||
return nil, io.EOF
|
||||
}
|
||||
if err != nil {
|
||||
return nil, handleError("failed to get sub tree", err)
|
||||
}
|
||||
|
||||
return resp.Body, nil
|
||||
}
|
||||
|
||||
// BurnedList invokes eponymous method from TreeServiceClient.
|
||||
//
|
||||
// Can return predefined errors:
|
||||
// * ErrNodeNotFound
|
||||
// * ErrNodeAccessDenied.
|
||||
func (p *Pool) BurnedList(ctx context.Context, prm BurnedListParams) (*BurnedListReader, error) {
|
||||
request := &grpcService.BurnedListRequest{
|
||||
Body: &grpcService.BurnedListRequest_Body{
|
||||
ContainerId: prm.CID[:],
|
||||
TreeId: prm.TreeID,
|
||||
Start: prm.Start,
|
||||
},
|
||||
}
|
||||
|
||||
if err := p.signRequest(request.Body, func(key, sign []byte) {
|
||||
request.Signature = &grpcService.Signature{
|
||||
Key: key,
|
||||
Sign: sign,
|
||||
}
|
||||
}); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
var cli grpcService.TreeService_BurnedListClient
|
||||
if err := p.requestWithRetry(ctx, func(client grpcService.TreeServiceClient) (inErr error) {
|
||||
cli, inErr = client.BurnedList(ctx, request)
|
||||
return handleError("failed to get sub tree client", inErr)
|
||||
}); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return &BurnedListReader{cli: cli}, nil
|
||||
}
|
||||
|
||||
// BurnedListByPrefix invokes eponymous method from TreeServiceClient.
|
||||
//
|
||||
// Can return predefined errors:
|
||||
// * ErrNodeNotFound
|
||||
// * ErrNodeAccessDenied.
|
||||
func (p *Pool) BurnedListByPrefix(ctx context.Context, prm BurnedListByPrefixParams) (*grpcService.BurnedListByPrefixResponse_Body, error) {
|
||||
request := &grpcService.BurnedListByPrefixRequest{
|
||||
Body: &grpcService.BurnedListByPrefixRequest_Body{
|
||||
ContainerId: prm.CID[:],
|
||||
TreeId: prm.TreeID,
|
||||
Key: prm.Prefix,
|
||||
},
|
||||
}
|
||||
|
||||
if err := p.signRequest(request.Body, func(key, sign []byte) {
|
||||
request.Signature = &grpcService.Signature{
|
||||
Key: key,
|
||||
Sign: sign,
|
||||
}
|
||||
}); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
var resp *grpcService.BurnedListByPrefixResponse
|
||||
if err := p.requestWithRetry(ctx, func(client grpcService.TreeServiceClient) (inErr error) {
|
||||
resp, inErr = client.BurnedListByPrefix(ctx, request)
|
||||
return handleError("failed to get burned list by prefix", inErr)
|
||||
}); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
body := resp.GetBody()
|
||||
if body == nil {
|
||||
return nil, errors.New("nil body in tree service response")
|
||||
}
|
||||
|
||||
return body, nil
|
||||
}
|
||||
|
||||
// Close closes the Pool and releases all the associated resources.
|
||||
func (p *Pool) Close() error {
|
||||
p.cancel()
|
||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -4,7 +4,7 @@
|
|||
// Code generated by protoc-gen-go-grpc. DO NOT EDIT.
|
||||
// versions:
|
||||
// - protoc-gen-go-grpc v1.3.0
|
||||
// - protoc v3.21.9
|
||||
// - protoc v4.25.0
|
||||
// source: pkg/services/tree/service.proto
|
||||
|
||||
package tree
|
||||
|
@ -22,16 +22,23 @@ import (
|
|||
const _ = grpc.SupportPackageIsVersion7
|
||||
|
||||
const (
|
||||
TreeService_Add_FullMethodName = "/tree.TreeService/Add"
|
||||
TreeService_AddByPath_FullMethodName = "/tree.TreeService/AddByPath"
|
||||
TreeService_Remove_FullMethodName = "/tree.TreeService/Remove"
|
||||
TreeService_Move_FullMethodName = "/tree.TreeService/Move"
|
||||
TreeService_GetNodeByPath_FullMethodName = "/tree.TreeService/GetNodeByPath"
|
||||
TreeService_GetSubTree_FullMethodName = "/tree.TreeService/GetSubTree"
|
||||
TreeService_TreeList_FullMethodName = "/tree.TreeService/TreeList"
|
||||
TreeService_Apply_FullMethodName = "/tree.TreeService/Apply"
|
||||
TreeService_GetOpLog_FullMethodName = "/tree.TreeService/GetOpLog"
|
||||
TreeService_Healthcheck_FullMethodName = "/tree.TreeService/Healthcheck"
|
||||
TreeService_Add_FullMethodName = "/tree.TreeService/Add"
|
||||
TreeService_AddByPath_FullMethodName = "/tree.TreeService/AddByPath"
|
||||
TreeService_Remove_FullMethodName = "/tree.TreeService/Remove"
|
||||
TreeService_Move_FullMethodName = "/tree.TreeService/Move"
|
||||
TreeService_GetNodeByPath_FullMethodName = "/tree.TreeService/GetNodeByPath"
|
||||
TreeService_GetSubTree_FullMethodName = "/tree.TreeService/GetSubTree"
|
||||
TreeService_TreeList_FullMethodName = "/tree.TreeService/TreeList"
|
||||
TreeService_Apply_FullMethodName = "/tree.TreeService/Apply"
|
||||
TreeService_GetOpLog_FullMethodName = "/tree.TreeService/GetOpLog"
|
||||
TreeService_Healthcheck_FullMethodName = "/tree.TreeService/Healthcheck"
|
||||
TreeService_BurnedAdd_FullMethodName = "/tree.TreeService/BurnedAdd"
|
||||
TreeService_BurnedRemove_FullMethodName = "/tree.TreeService/BurnedRemove"
|
||||
TreeService_BurnedApply_FullMethodName = "/tree.TreeService/BurnedApply"
|
||||
TreeService_BurnedGet_FullMethodName = "/tree.TreeService/BurnedGet"
|
||||
TreeService_BurnedGetLatestByPrefix_FullMethodName = "/tree.TreeService/BurnedGetLatestByPrefix"
|
||||
TreeService_BurnedListByPrefix_FullMethodName = "/tree.TreeService/BurnedListByPrefix"
|
||||
TreeService_BurnedList_FullMethodName = "/tree.TreeService/BurnedList"
|
||||
)
|
||||
|
||||
// TreeServiceClient is the client API for TreeService service.
|
||||
|
@ -59,6 +66,13 @@ type TreeServiceClient interface {
|
|||
GetOpLog(ctx context.Context, in *GetOpLogRequest, opts ...grpc.CallOption) (TreeService_GetOpLogClient, error)
|
||||
// Healthcheck is a dummy rpc to check service availability
|
||||
Healthcheck(ctx context.Context, in *HealthcheckRequest, opts ...grpc.CallOption) (*HealthcheckResponse, error)
|
||||
BurnedAdd(ctx context.Context, in *BurnedAddRequest, opts ...grpc.CallOption) (*BurnedAddResponse, error)
|
||||
BurnedRemove(ctx context.Context, in *BurnedRemoveRequest, opts ...grpc.CallOption) (*BurnedRemoveResponse, error)
|
||||
BurnedApply(ctx context.Context, in *BurnedApplyRequest, opts ...grpc.CallOption) (*BurnedApplyResponse, error)
|
||||
BurnedGet(ctx context.Context, in *BurnedGetRequest, opts ...grpc.CallOption) (*BurnedGetResponse, error)
|
||||
BurnedGetLatestByPrefix(ctx context.Context, in *BurnedGetLatestByPrefixRequest, opts ...grpc.CallOption) (*BurnedGetLatestByPrefixResponse, error)
|
||||
BurnedListByPrefix(ctx context.Context, in *BurnedListByPrefixRequest, opts ...grpc.CallOption) (*BurnedListByPrefixResponse, error)
|
||||
BurnedList(ctx context.Context, in *BurnedListRequest, opts ...grpc.CallOption) (TreeService_BurnedListClient, error)
|
||||
}
|
||||
|
||||
type treeServiceClient struct {
|
||||
|
@ -205,6 +219,92 @@ func (c *treeServiceClient) Healthcheck(ctx context.Context, in *HealthcheckRequ
|
|||
return out, nil
|
||||
}
|
||||
|
||||
func (c *treeServiceClient) BurnedAdd(ctx context.Context, in *BurnedAddRequest, opts ...grpc.CallOption) (*BurnedAddResponse, error) {
|
||||
out := new(BurnedAddResponse)
|
||||
err := c.cc.Invoke(ctx, TreeService_BurnedAdd_FullMethodName, in, out, opts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
func (c *treeServiceClient) BurnedRemove(ctx context.Context, in *BurnedRemoveRequest, opts ...grpc.CallOption) (*BurnedRemoveResponse, error) {
|
||||
out := new(BurnedRemoveResponse)
|
||||
err := c.cc.Invoke(ctx, TreeService_BurnedRemove_FullMethodName, in, out, opts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
func (c *treeServiceClient) BurnedApply(ctx context.Context, in *BurnedApplyRequest, opts ...grpc.CallOption) (*BurnedApplyResponse, error) {
|
||||
out := new(BurnedApplyResponse)
|
||||
err := c.cc.Invoke(ctx, TreeService_BurnedApply_FullMethodName, in, out, opts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
func (c *treeServiceClient) BurnedGet(ctx context.Context, in *BurnedGetRequest, opts ...grpc.CallOption) (*BurnedGetResponse, error) {
|
||||
out := new(BurnedGetResponse)
|
||||
err := c.cc.Invoke(ctx, TreeService_BurnedGet_FullMethodName, in, out, opts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
func (c *treeServiceClient) BurnedGetLatestByPrefix(ctx context.Context, in *BurnedGetLatestByPrefixRequest, opts ...grpc.CallOption) (*BurnedGetLatestByPrefixResponse, error) {
|
||||
out := new(BurnedGetLatestByPrefixResponse)
|
||||
err := c.cc.Invoke(ctx, TreeService_BurnedGetLatestByPrefix_FullMethodName, in, out, opts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
func (c *treeServiceClient) BurnedListByPrefix(ctx context.Context, in *BurnedListByPrefixRequest, opts ...grpc.CallOption) (*BurnedListByPrefixResponse, error) {
|
||||
out := new(BurnedListByPrefixResponse)
|
||||
err := c.cc.Invoke(ctx, TreeService_BurnedListByPrefix_FullMethodName, in, out, opts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
func (c *treeServiceClient) BurnedList(ctx context.Context, in *BurnedListRequest, opts ...grpc.CallOption) (TreeService_BurnedListClient, error) {
|
||||
stream, err := c.cc.NewStream(ctx, &TreeService_ServiceDesc.Streams[2], TreeService_BurnedList_FullMethodName, opts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
x := &treeServiceBurnedListClient{stream}
|
||||
if err := x.ClientStream.SendMsg(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if err := x.ClientStream.CloseSend(); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return x, nil
|
||||
}
|
||||
|
||||
type TreeService_BurnedListClient interface {
|
||||
Recv() (*BurnedListResponse, error)
|
||||
grpc.ClientStream
|
||||
}
|
||||
|
||||
type treeServiceBurnedListClient struct {
|
||||
grpc.ClientStream
|
||||
}
|
||||
|
||||
func (x *treeServiceBurnedListClient) Recv() (*BurnedListResponse, error) {
|
||||
m := new(BurnedListResponse)
|
||||
if err := x.ClientStream.RecvMsg(m); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return m, nil
|
||||
}
|
||||
|
||||
// TreeServiceServer is the server API for TreeService service.
|
||||
// All implementations should embed UnimplementedTreeServiceServer
|
||||
// for forward compatibility
|
||||
|
@ -230,6 +330,13 @@ type TreeServiceServer interface {
|
|||
GetOpLog(*GetOpLogRequest, TreeService_GetOpLogServer) error
|
||||
// Healthcheck is a dummy rpc to check service availability
|
||||
Healthcheck(context.Context, *HealthcheckRequest) (*HealthcheckResponse, error)
|
||||
BurnedAdd(context.Context, *BurnedAddRequest) (*BurnedAddResponse, error)
|
||||
BurnedRemove(context.Context, *BurnedRemoveRequest) (*BurnedRemoveResponse, error)
|
||||
BurnedApply(context.Context, *BurnedApplyRequest) (*BurnedApplyResponse, error)
|
||||
BurnedGet(context.Context, *BurnedGetRequest) (*BurnedGetResponse, error)
|
||||
BurnedGetLatestByPrefix(context.Context, *BurnedGetLatestByPrefixRequest) (*BurnedGetLatestByPrefixResponse, error)
|
||||
BurnedListByPrefix(context.Context, *BurnedListByPrefixRequest) (*BurnedListByPrefixResponse, error)
|
||||
BurnedList(*BurnedListRequest, TreeService_BurnedListServer) error
|
||||
}
|
||||
|
||||
// UnimplementedTreeServiceServer should be embedded to have forward compatible implementations.
|
||||
|
@ -266,6 +373,27 @@ func (UnimplementedTreeServiceServer) GetOpLog(*GetOpLogRequest, TreeService_Get
|
|||
func (UnimplementedTreeServiceServer) Healthcheck(context.Context, *HealthcheckRequest) (*HealthcheckResponse, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method Healthcheck not implemented")
|
||||
}
|
||||
func (UnimplementedTreeServiceServer) BurnedAdd(context.Context, *BurnedAddRequest) (*BurnedAddResponse, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method BurnedAdd not implemented")
|
||||
}
|
||||
func (UnimplementedTreeServiceServer) BurnedRemove(context.Context, *BurnedRemoveRequest) (*BurnedRemoveResponse, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method BurnedRemove not implemented")
|
||||
}
|
||||
func (UnimplementedTreeServiceServer) BurnedApply(context.Context, *BurnedApplyRequest) (*BurnedApplyResponse, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method BurnedApply not implemented")
|
||||
}
|
||||
func (UnimplementedTreeServiceServer) BurnedGet(context.Context, *BurnedGetRequest) (*BurnedGetResponse, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method BurnedGet not implemented")
|
||||
}
|
||||
func (UnimplementedTreeServiceServer) BurnedGetLatestByPrefix(context.Context, *BurnedGetLatestByPrefixRequest) (*BurnedGetLatestByPrefixResponse, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method BurnedGetLatestByPrefix not implemented")
|
||||
}
|
||||
func (UnimplementedTreeServiceServer) BurnedListByPrefix(context.Context, *BurnedListByPrefixRequest) (*BurnedListByPrefixResponse, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method BurnedListByPrefix not implemented")
|
||||
}
|
||||
func (UnimplementedTreeServiceServer) BurnedList(*BurnedListRequest, TreeService_BurnedListServer) error {
|
||||
return status.Errorf(codes.Unimplemented, "method BurnedList not implemented")
|
||||
}
|
||||
|
||||
// UnsafeTreeServiceServer may be embedded to opt out of forward compatibility for this service.
|
||||
// Use of this interface is not recommended, as added methods to TreeServiceServer will
|
||||
|
@ -464,6 +592,135 @@ func _TreeService_Healthcheck_Handler(srv interface{}, ctx context.Context, dec
|
|||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
func _TreeService_BurnedAdd_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(BurnedAddRequest)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if interceptor == nil {
|
||||
return srv.(TreeServiceServer).BurnedAdd(ctx, in)
|
||||
}
|
||||
info := &grpc.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: TreeService_BurnedAdd_FullMethodName,
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(TreeServiceServer).BurnedAdd(ctx, req.(*BurnedAddRequest))
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
func _TreeService_BurnedRemove_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(BurnedRemoveRequest)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if interceptor == nil {
|
||||
return srv.(TreeServiceServer).BurnedRemove(ctx, in)
|
||||
}
|
||||
info := &grpc.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: TreeService_BurnedRemove_FullMethodName,
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(TreeServiceServer).BurnedRemove(ctx, req.(*BurnedRemoveRequest))
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
func _TreeService_BurnedApply_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(BurnedApplyRequest)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if interceptor == nil {
|
||||
return srv.(TreeServiceServer).BurnedApply(ctx, in)
|
||||
}
|
||||
info := &grpc.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: TreeService_BurnedApply_FullMethodName,
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(TreeServiceServer).BurnedApply(ctx, req.(*BurnedApplyRequest))
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
func _TreeService_BurnedGet_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(BurnedGetRequest)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if interceptor == nil {
|
||||
return srv.(TreeServiceServer).BurnedGet(ctx, in)
|
||||
}
|
||||
info := &grpc.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: TreeService_BurnedGet_FullMethodName,
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(TreeServiceServer).BurnedGet(ctx, req.(*BurnedGetRequest))
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
func _TreeService_BurnedGetLatestByPrefix_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(BurnedGetLatestByPrefixRequest)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if interceptor == nil {
|
||||
return srv.(TreeServiceServer).BurnedGetLatestByPrefix(ctx, in)
|
||||
}
|
||||
info := &grpc.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: TreeService_BurnedGetLatestByPrefix_FullMethodName,
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(TreeServiceServer).BurnedGetLatestByPrefix(ctx, req.(*BurnedGetLatestByPrefixRequest))
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
func _TreeService_BurnedListByPrefix_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(BurnedListByPrefixRequest)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if interceptor == nil {
|
||||
return srv.(TreeServiceServer).BurnedListByPrefix(ctx, in)
|
||||
}
|
||||
info := &grpc.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: TreeService_BurnedListByPrefix_FullMethodName,
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(TreeServiceServer).BurnedListByPrefix(ctx, req.(*BurnedListByPrefixRequest))
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
func _TreeService_BurnedList_Handler(srv interface{}, stream grpc.ServerStream) error {
|
||||
m := new(BurnedListRequest)
|
||||
if err := stream.RecvMsg(m); err != nil {
|
||||
return err
|
||||
}
|
||||
return srv.(TreeServiceServer).BurnedList(m, &treeServiceBurnedListServer{stream})
|
||||
}
|
||||
|
||||
type TreeService_BurnedListServer interface {
|
||||
Send(*BurnedListResponse) error
|
||||
grpc.ServerStream
|
||||
}
|
||||
|
||||
type treeServiceBurnedListServer struct {
|
||||
grpc.ServerStream
|
||||
}
|
||||
|
||||
func (x *treeServiceBurnedListServer) Send(m *BurnedListResponse) error {
|
||||
return x.ServerStream.SendMsg(m)
|
||||
}
|
||||
|
||||
// TreeService_ServiceDesc is the grpc.ServiceDesc for TreeService service.
|
||||
// It's only intended for direct use with grpc.RegisterService,
|
||||
// and not to be introspected or modified (even as a copy)
|
||||
|
@ -503,6 +760,30 @@ var TreeService_ServiceDesc = grpc.ServiceDesc{
|
|||
MethodName: "Healthcheck",
|
||||
Handler: _TreeService_Healthcheck_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "BurnedAdd",
|
||||
Handler: _TreeService_BurnedAdd_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "BurnedRemove",
|
||||
Handler: _TreeService_BurnedRemove_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "BurnedApply",
|
||||
Handler: _TreeService_BurnedApply_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "BurnedGet",
|
||||
Handler: _TreeService_BurnedGet_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "BurnedGetLatestByPrefix",
|
||||
Handler: _TreeService_BurnedGetLatestByPrefix_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "BurnedListByPrefix",
|
||||
Handler: _TreeService_BurnedListByPrefix_Handler,
|
||||
},
|
||||
},
|
||||
Streams: []grpc.StreamDesc{
|
||||
{
|
||||
|
@ -515,6 +796,11 @@ var TreeService_ServiceDesc = grpc.ServiceDesc{
|
|||
Handler: _TreeService_GetOpLog_Handler,
|
||||
ServerStreams: true,
|
||||
},
|
||||
{
|
||||
StreamName: "BurnedList",
|
||||
Handler: _TreeService_BurnedList_Handler,
|
||||
ServerStreams: true,
|
||||
},
|
||||
},
|
||||
Metadata: "pkg/services/tree/service.proto",
|
||||
}
|
||||
|
|
|
@ -3,8 +3,8 @@
|
|||
|
||||
// Code generated by protoc-gen-go. DO NOT EDIT.
|
||||
// versions:
|
||||
// protoc-gen-go v1.26.0
|
||||
// protoc v3.21.9
|
||||
// protoc-gen-go v1.33.0
|
||||
// protoc v4.25.0
|
||||
// source: pkg/services/tree/types.proto
|
||||
|
||||
package tree
|
||||
|
|
|
@ -1,12 +1,12 @@
|
|||
#!/bin/bash
|
||||
|
||||
REVISION="b3695411d907c3c65485bab04f9ff8479a72906b"
|
||||
REVISION="61c920919bba627cb4bb661afe61243649ec06a6"
|
||||
|
||||
echo "tree service revision ${REVISION}"
|
||||
|
||||
# regexp below find all link to source code files which end with ".pb.go" and retrieve the file names
|
||||
# we use `[^.]*` as non greedy workaround for `.*`
|
||||
FILES=$(curl -s https://git.frostfs.info/TrueCloudLab/frostfs-node/src/commit/${REVISION}/pkg/services/tree | sed -n "s,.*\"/TrueCloudLab/frostfs-node/src/commit/${REVISION}/pkg/services/tree/\([^.]*\.pb\.go\)\".*,\1,p")
|
||||
FILES=$(curl -s https://git.frostfs.info/fyrchik/frostfs-node/src/commit/${REVISION}/pkg/services/tree | sed -n "s,.*\"/fyrchik/frostfs-node/src/commit/${REVISION}/pkg/services/tree/\([^.]*\.pb\.go\)\".*,\1,p")
|
||||
|
||||
for file in $FILES; do
|
||||
if [[ $file == *"frostfs"* ]]; then
|
||||
|
@ -15,5 +15,5 @@ for file in $FILES; do
|
|||
else
|
||||
echo "sync '$file' in tree service"
|
||||
fi
|
||||
curl -s "https://git.frostfs.info/TrueCloudLab/frostfs-node/raw/commit/${REVISION}/pkg/services/tree/${file}" -o "./pool/tree/service/${file}"
|
||||
curl -s "https://git.frostfs.info/fyrchik/frostfs-node/raw/commit/${REVISION}/pkg/services/tree/${file}" -o "./pool/tree/service/${file}"
|
||||
done
|
||||
|
|
Loading…
Reference in a new issue