github.com/keybase/client/go@v0.0.0-20240309051027-028f7c731f8b/service/notify_fs_request.go (about)

     1  // Copyright 2016 Keybase, Inc. All rights reserved. Use of
     2  // this source code is governed by the included BSD license.
     3  
     4  package service
     5  
     6  import (
     7  	"github.com/keybase/client/go/libkb"
     8  	keybase1 "github.com/keybase/client/go/protocol/keybase1"
     9  	"github.com/keybase/go-framed-msgpack-rpc/rpc"
    10  	"golang.org/x/net/context"
    11  )
    12  
    13  type notifyFSRequestHandler struct {
    14  	*BaseHandler
    15  	libkb.Contextified
    16  }
    17  
    18  func (h *notifyFSRequestHandler) client() (*keybase1.NotifyFSRequestClient, error) {
    19  	xp := h.G().ConnectionManager.LookupByClientType(keybase1.ClientType_KBFS)
    20  	if xp == nil {
    21  		return nil, libkb.KBFSNotRunningError{}
    22  	}
    23  	return &keybase1.NotifyFSRequestClient{
    24  		Cli: rpc.NewClient(xp, libkb.NewContextifiedErrorUnwrapper(h.G()), nil),
    25  	}, nil
    26  }
    27  
    28  func newNotifyFSRequestHandler(xp rpc.Transporter, g *libkb.GlobalContext) *notifyFSRequestHandler {
    29  	return &notifyFSRequestHandler{
    30  		BaseHandler:  NewBaseHandler(g, xp),
    31  		Contextified: libkb.NewContextified(g),
    32  	}
    33  }
    34  
    35  func (h *notifyFSRequestHandler) FSEditListRequest(ctx context.Context, arg keybase1.FSEditListRequest) error {
    36  	cli, err := h.client()
    37  	if err != nil {
    38  		return err
    39  	}
    40  	return cli.FSEditListRequest(ctx, arg)
    41  }
    42  
    43  func (h *notifyFSRequestHandler) FSSyncStatusRequest(ctx context.Context, arg keybase1.FSSyncStatusRequest) error {
    44  	cli, err := h.client()
    45  	if err != nil {
    46  		return err
    47  	}
    48  	return cli.FSSyncStatusRequest(ctx, arg)
    49  }