Documentation
¶
Index ¶
- Constants
- func AuthInterceptor() grpc.UnaryServerInterceptor
- func StreamAuthInterceptor() grpc.StreamServerInterceptor
- type GRPCService
- func (g *GRPCService) BatchOperation(ctx context.Context, req *BatchOperationRequest) (*BatchOperationResponse, error)
- func (g *GRPCService) BeginUpload(ctx context.Context, req *BeginUploadRequest) (*BeginUploadResponse, error)
- func (g *GRPCService) CancelUpload(ctx context.Context, req *CancelUploadRequest) (*CancelUploadResponse, error)
- func (g *GRPCService) Copy(ctx context.Context, req *CopyRequest) (*CopyResponse, error)
- func (g *GRPCService) CreateDirectory(ctx context.Context, req *CreateDirectoryRequest) (*CreateDirectoryResponse, error)
- func (g *GRPCService) Delete(ctx context.Context, req *DeleteRequest) (*DeleteResponse, error)
- func (g *GRPCService) DownloadFile(req *DownloadFileRequest, ...) error
- func (g *GRPCService) FinalizeUpload(ctx context.Context, req *FinalizeUploadRequest) (*FinalizeUploadResponse, error)
- func (g *GRPCService) GetCurrentVersion(ctx context.Context, req *GetCurrentVersionRequest) (*GetCurrentVersionResponse, error)
- func (g *GRPCService) GetFileInfo(ctx context.Context, req *GetFileInfoRequest) (*GetFileInfoResponse, error)
- func (g *GRPCService) GetSyncStatus(ctx context.Context, req *SyncStatusRequest) (*SyncStatusResponse, error)
- func (g *GRPCService) ListChanges(ctx context.Context, req *ListChangesRequest) (*ListChangesResponse, error)
- func (g *GRPCService) ListDirectory(ctx context.Context, req *ListDirectoryRequest) (*ListDirectoryResponse, error)
- func (g *GRPCService) Move(ctx context.Context, req *MoveRequest) (*MoveResponse, error)
- func (g *GRPCService) UploadChunk(ctx context.Context, req *UploadChunkRequest) (*UploadChunkResponse, error)
- func (g *GRPCService) UploadFile(ctx context.Context, req *UploadFileRequest) (*UploadFileResponse, error)
- type Service
- func (s *Service) BeginUpload(ctx context.Context, repo *model.Repository, path string, totalSize int64, ...) (string, []int, error)
- func (s *Service) CancelUpload(ctx context.Context, uploadID string) error
- func (s *Service) Copy(ctx context.Context, repo *model.Repository, sourcePath, destPath string, ...) error
- func (s *Service) CreateDirectory(ctx context.Context, repo *model.Repository, path string, userID int) error
- func (s *Service) Delete(ctx context.Context, repo *model.Repository, path string, recursive bool, ...) error
- func (s *Service) DownloadFile(ctx context.Context, repo *model.Repository, path string, ifNoneMatch string, ...) (*model.FileObject, io.ReadCloser, error)
- func (s *Service) FinalizeUpload(ctx context.Context, uploadID string, repo *model.Repository, userID int) (string, int64, error)
- func (s *Service) GetCurrentVersion(ctx context.Context, repoID int) (*model.RepositoryVersion, error)
- func (s *Service) GetFileInfo(ctx context.Context, repo *model.Repository, path string, userID int) (*model.FileObject, error)
- func (s *Service) GetSyncStatus(ctx context.Context, repo *model.Repository, path string, clientETag string, ...) (string, *model.FileObject, error)
- func (s *Service) ListChanges(ctx context.Context, repoID int, sinceVersion string, maxChanges int) ([]*model.ChangeLog, error)
- func (s *Service) ListDirectory(ctx context.Context, repo *model.Repository, path string, offset, limit int, ...) ([]*model.FileObject, int64, error)
- func (s *Service) Move(ctx context.Context, repo *model.Repository, sourcePath, destPath string, ...) error
- func (s *Service) UploadChunk(ctx context.Context, uploadID string, chunkIndex int, data []byte) error
- func (s *Service) UploadFile(ctx context.Context, repo *model.Repository, path string, data []byte, ...) (string, string, int64, error)
Constants ¶
const ( UserIDContextKey contextKey = "userID" UsernameContextKey contextKey = "username" RepoNameContextKey contextKey = "repoName" )
const ( MaxSimpleUploadSize = 10 * 1024 * 1024 // 10MB ChunkSize = 1024 * 1024 // 1MB chunks MaxConnectionTime = 24 * time.Hour ChunkTempDir = "chunks" )
Variables ¶
This section is empty.
Functions ¶
func AuthInterceptor ¶
func AuthInterceptor() grpc.UnaryServerInterceptor
AuthInterceptor creates a gRPC unary interceptor for authentication
func StreamAuthInterceptor ¶
func StreamAuthInterceptor() grpc.StreamServerInterceptor
StreamAuthInterceptor creates a gRPC stream interceptor for authentication
Types ¶
type GRPCService ¶
type GRPCService struct {
UnimplementedSyncServiceServer
// contains filtered or unexported fields
}
GRPCService implements the gRPC SyncService server
func NewGRPCService ¶
func NewGRPCService(database *bun.DB) *GRPCService
NewGRPCService creates a new gRPC service wrapper
func (*GRPCService) BatchOperation ¶
func (g *GRPCService) BatchOperation(ctx context.Context, req *BatchOperationRequest) (*BatchOperationResponse, error)
BatchOperation implements the BatchOperation RPC
func (*GRPCService) BeginUpload ¶
func (g *GRPCService) BeginUpload(ctx context.Context, req *BeginUploadRequest) (*BeginUploadResponse, error)
BeginUpload implements the BeginUpload RPC
func (*GRPCService) CancelUpload ¶
func (g *GRPCService) CancelUpload(ctx context.Context, req *CancelUploadRequest) (*CancelUploadResponse, error)
CancelUpload implements the CancelUpload RPC
func (*GRPCService) Copy ¶
func (g *GRPCService) Copy(ctx context.Context, req *CopyRequest) (*CopyResponse, error)
Copy implements the Copy RPC
func (*GRPCService) CreateDirectory ¶
func (g *GRPCService) CreateDirectory(ctx context.Context, req *CreateDirectoryRequest) (*CreateDirectoryResponse, error)
CreateDirectory implements the CreateDirectory RPC
func (*GRPCService) Delete ¶
func (g *GRPCService) Delete(ctx context.Context, req *DeleteRequest) (*DeleteResponse, error)
Delete implements the Delete RPC
func (*GRPCService) DownloadFile ¶
func (g *GRPCService) DownloadFile(req *DownloadFileRequest, stream grpc.ServerStreamingServer[DownloadFileResponse]) error
DownloadFile implements the DownloadFile streaming RPC
func (*GRPCService) FinalizeUpload ¶
func (g *GRPCService) FinalizeUpload(ctx context.Context, req *FinalizeUploadRequest) (*FinalizeUploadResponse, error)
FinalizeUpload implements the FinalizeUpload RPC
func (*GRPCService) GetCurrentVersion ¶
func (g *GRPCService) GetCurrentVersion(ctx context.Context, req *GetCurrentVersionRequest) (*GetCurrentVersionResponse, error)
GetCurrentVersion implements the GetCurrentVersion RPC
func (*GRPCService) GetFileInfo ¶
func (g *GRPCService) GetFileInfo(ctx context.Context, req *GetFileInfoRequest) (*GetFileInfoResponse, error)
GetFileInfo implements the GetFileInfo RPC
func (*GRPCService) GetSyncStatus ¶
func (g *GRPCService) GetSyncStatus(ctx context.Context, req *SyncStatusRequest) (*SyncStatusResponse, error)
GetSyncStatus implements the GetSyncStatus RPC
func (*GRPCService) ListChanges ¶
func (g *GRPCService) ListChanges(ctx context.Context, req *ListChangesRequest) (*ListChangesResponse, error)
ListChanges implements the ListChanges RPC
func (*GRPCService) ListDirectory ¶
func (g *GRPCService) ListDirectory(ctx context.Context, req *ListDirectoryRequest) (*ListDirectoryResponse, error)
ListDirectory implements the ListDirectory RPC
func (*GRPCService) Move ¶
func (g *GRPCService) Move(ctx context.Context, req *MoveRequest) (*MoveResponse, error)
Move implements the Move RPC
func (*GRPCService) UploadChunk ¶
func (g *GRPCService) UploadChunk(ctx context.Context, req *UploadChunkRequest) (*UploadChunkResponse, error)
UploadChunk implements the UploadChunk RPC
func (*GRPCService) UploadFile ¶
func (g *GRPCService) UploadFile(ctx context.Context, req *UploadFileRequest) (*UploadFileResponse, error)
UploadFile implements the UploadFile RPC
type Service ¶
type Service struct {
// contains filtered or unexported fields
}
func NewService ¶
func (*Service) BeginUpload ¶
func (*Service) CancelUpload ¶
func (*Service) CreateDirectory ¶
func (*Service) DownloadFile ¶
func (s *Service) DownloadFile(ctx context.Context, repo *model.Repository, path string, ifNoneMatch string, userID int) (*model.FileObject, io.ReadCloser, error)
func (*Service) FinalizeUpload ¶
func (*Service) GetCurrentVersion ¶
func (*Service) GetFileInfo ¶
func (s *Service) GetFileInfo(ctx context.Context, repo *model.Repository, path string, userID int) (*model.FileObject, error)