github.com/NVIDIA/aistore@v1.3.23-0.20240517131212-7df6609be51d/core/backend.go (about) 1 // Package core provides core metadata and in-cluster API 2 /* 3 * Copyright (c) 2018-2024, NVIDIA CORPORATION. All rights reserved. 4 */ 5 package core 6 7 import ( 8 "context" 9 "io" 10 "net/http" 11 "os" 12 13 "github.com/NVIDIA/aistore/api/apc" 14 "github.com/NVIDIA/aistore/cmn" 15 "github.com/NVIDIA/aistore/cmn/cos" 16 "github.com/NVIDIA/aistore/core/meta" 17 "github.com/NVIDIA/aistore/memsys" 18 ) 19 20 type ( 21 GetReaderResult struct { 22 R io.ReadCloser 23 Err error 24 ExpCksum *cos.Cksum 25 Size int64 26 ErrCode int 27 } 28 LsoInvCtx struct { 29 Lom *LOM 30 Lmfh *os.File 31 Name string 32 ID string 33 Schema []string 34 SGL *memsys.SGL 35 Size int64 36 EOF bool 37 } 38 39 Backend interface { 40 Provider() string 41 42 CreateBucket(bck *meta.Bck) (ecode int, err error) 43 ListObjects(bck *meta.Bck, msg *apc.LsoMsg, lst *cmn.LsoRes) (ecode int, err error) 44 ListBuckets(qbck cmn.QueryBcks) (bcks cmn.Bcks, ecode int, err error) 45 PutObj(r io.ReadCloser, lom *LOM, origReq *http.Request) (ecode int, err error) 46 DeleteObj(lom *LOM) (ecode int, err error) 47 48 // head 49 HeadBucket(ctx context.Context, bck *meta.Bck) (bckProps cos.StrKVs, ecode int, err error) 50 HeadObj(ctx context.Context, lom *LOM, origReq *http.Request) (objAttrs *cmn.ObjAttrs, ecode int, err error) 51 52 // get 53 GetObj(ctx context.Context, lom *LOM, owt cmn.OWT, origReq *http.Request) (ecode int, err error) // calls GetObjReader 54 GetObjReader(ctx context.Context, lom *LOM, offset, length int64) GetReaderResult 55 56 // bucket inventory 57 GetBucketInv(bck *meta.Bck, ctx *LsoInvCtx) (ecode int, err error) 58 ListObjectsInv(bck *meta.Bck, msg *apc.LsoMsg, lst *cmn.LsoRes, ctx *LsoInvCtx) error 59 } 60 )