Codebase cleanup & optimization (#1493)

Remove old v1 types that are no longer used and move fetcher structs to fetcher directory.
This commit is contained in:
Ta-Ching Chen
2020-01-16 16:47:32 +08:00
committed by GitHub
parent 574fb55fcf
commit bb3e6d6907
37 changed files with 305 additions and 498 deletions
+5 -5
View File
@@ -15,7 +15,7 @@ import (
"golang.org/x/net/context/ctxhttp"
ferror "github.com/fission/fission/pkg/error"
"github.com/fission/fission/pkg/types"
"github.com/fission/fission/pkg/fetcher"
)
type (
@@ -48,23 +48,23 @@ func (c *Client) getUploadUrl() string {
return c.url + "/upload"
}
func (c *Client) Specialize(ctx context.Context, req *types.FunctionSpecializeRequest) error {
func (c *Client) Specialize(ctx context.Context, req *fetcher.FunctionSpecializeRequest) error {
_, err := sendRequest(c.logger, ctx, c.httpClient, req, c.getSpecializeUrl())
return err
}
func (c *Client) Fetch(ctx context.Context, fr *types.FunctionFetchRequest) error {
func (c *Client) Fetch(ctx context.Context, fr *fetcher.FunctionFetchRequest) error {
_, err := sendRequest(c.logger, ctx, c.httpClient, fr, c.getFetchUrl())
return err
}
func (c *Client) Upload(ctx context.Context, fr *types.ArchiveUploadRequest) (*types.ArchiveUploadResponse, error) {
func (c *Client) Upload(ctx context.Context, fr *fetcher.ArchiveUploadRequest) (*fetcher.ArchiveUploadResponse, error) {
body, err := sendRequest(c.logger, ctx, c.httpClient, fr, c.getUploadUrl())
if err != nil {
return nil, err
}
uploadResp := types.ArchiveUploadResponse{}
uploadResp := fetcher.ArchiveUploadResponse{}
err = json.Unmarshal(body, &uploadResp)
if err != nil {
return nil, err