1818package core
1919
2020import (
21- "github.com/rs/zerolog"
22- "github.com/tigrisdata/tigrisfs/core/cfg"
23- "github.com/tigrisdata/tigrisfs/log"
24-
2521 "context"
2622 "encoding/base64"
2723 "encoding/json"
@@ -39,6 +35,9 @@ import (
3935 "github.com/Azure/go-autorest/autorest"
4036 "github.com/Azure/go-autorest/autorest/azure"
4137 "github.com/google/uuid"
38+ "github.com/rs/zerolog"
39+ "github.com/tigrisdata/tigrisfs/core/cfg"
40+ "github.com/tigrisdata/tigrisfs/log"
4241)
4342
4443type ADLv2 struct {
@@ -51,8 +50,10 @@ type ADLv2 struct {
5150 bucket string
5251}
5352
54- const ADL2_CLIENT_REQUEST_ID = "X-Ms-Client-Request-Id"
55- const ADL2_REQUEST_ID = "X-Ms-Request-Id"
53+ const (
54+ ADL2_CLIENT_REQUEST_ID = "X-Ms-Client-Request-Id"
55+ ADL2_REQUEST_ID = "X-Ms-Request-Id"
56+ )
5657
5758var adl2Log = log .GetLogger ("adlv2" )
5859
@@ -230,7 +231,7 @@ func adlv2ErrLogHeaders(errCode string, resp *http.Response) {
230231 switch errCode {
231232 case "MissingRequiredHeader" , "UnsupportedHeader" :
232233 var s strings.Builder
233- for k , _ := range resp .Request .Header {
234+ for k := range resp .Request .Header {
234235 s .WriteString (k )
235236 s .WriteString (" " )
236237 }
@@ -252,7 +253,6 @@ func adlv2ErrLogHeaders(errCode string, resp *http.Response) {
252253}
253254
254255func mapADLv2Error (resp * http.Response , err error , rawError bool ) error {
255-
256256 if resp == nil {
257257 if err != nil {
258258 if detailedError , ok := err .(autorest.DetailedError ); ok {
@@ -624,7 +624,7 @@ func (b *ADLv2) toADLProperties(metadata map[string]*string) string {
624624 buf .WriteString (base64 .StdEncoding .EncodeToString ([]byte (* v )))
625625 buf .WriteString ("," )
626626 }
627- var s = buf .String ()
627+ s : = buf .String ()
628628 if len (s ) != 0 {
629629 // remove trailing comma
630630 s = s [:len (s )- 1 ]
@@ -633,7 +633,8 @@ func (b *ADLv2) toADLProperties(metadata map[string]*string) string {
633633}
634634
635635func (b * ADLv2 ) create (key string , pathType adl2.PathResourceType , contentType * string ,
636- metadata map [string ]* string , leaseId string ) (resp autorest.Response , err error ) {
636+ metadata map [string ]* string , leaseId string ,
637+ ) (resp autorest.Response , err error ) {
637638 resp , err = b .client .Create (context .TODO (), b .bucket , key ,
638639 pathType , "" , "" , "" , "" , "" , "" , "" , NilStr (contentType ),
639640 "" , "" , "" , "" , leaseId , "" , b .toADLProperties (metadata ), "" , "" , "" , "" , "" , "" ,
@@ -645,7 +646,8 @@ func (b *ADLv2) create(key string, pathType adl2.PathResourceType, contentType *
645646}
646647
647648func (b * ADLv2 ) append (key string , offset int64 , size int64 , body io.ReadSeeker ,
648- leaseId string ) (resp autorest.Response , err error ) {
649+ leaseId string ,
650+ ) (resp autorest.Response , err error ) {
649651 resp , err = b .client .Update (context .TODO (), adl2 .Append , b .bucket ,
650652 key , & offset , nil , nil , & size , "" , leaseId , "" ,
651653 "" , "" , "" , "" , "" , "" , "" , "" , "" , "" ,
@@ -789,7 +791,8 @@ func (b *ADLv2) MultipartBlobBegin(param *MultipartBlobBeginInput) (*MultipartBl
789791}
790792
791793func (b * ADLv2 ) lease (action adl2.PathLeaseAction , key string , leaseId string , durationSec int32 ,
792- ifMatch string ) error {
794+ ifMatch string ,
795+ ) error {
793796 var proposeLeaseId string
794797 var prevLeaseId string
795798 if action == adl2 .Acquire {
@@ -884,7 +887,7 @@ func (b *ADLv2) MultipartExpire(param *MultipartExpireInput) (*MultipartExpireOu
884887}
885888
886889func (b * ADLv2 ) RemoveBucket (param * RemoveBucketInput ) (* RemoveBucketOutput , error ) {
887- fs := adl2.FilesystemClient {b .client .BaseClient }
890+ fs := adl2.FilesystemClient {BaseClient : b .client .BaseClient }
888891 res , err := fs .Delete (context .TODO (), b .bucket , "" , "" , uuid .New ().String (), nil , "" )
889892 if err != nil {
890893 return nil , mapADLv2Error (res .Response , err , false )
@@ -893,7 +896,7 @@ func (b *ADLv2) RemoveBucket(param *RemoveBucketInput) (*RemoveBucketOutput, err
893896}
894897
895898func (b * ADLv2 ) MakeBucket (param * MakeBucketInput ) (* MakeBucketOutput , error ) {
896- fs := adl2.FilesystemClient {b .client .BaseClient }
899+ fs := adl2.FilesystemClient {BaseClient : b .client .BaseClient }
897900 res , err := fs .Create (context .TODO (), b .bucket , "" , uuid .New ().String (), nil , "" )
898901 if err != nil {
899902 return nil , mapADLv2Error (res .Response , err , false )
@@ -1761,7 +1764,6 @@ func (client adl2PathClient) UpdatePreparer(ctx context.Context, action adl2.Pat
17611764// UpdateSender sends the Update request. The method will close the
17621765// http.Response Body if it receives an error.
17631766func (client adl2PathClient ) UpdateSender (req * http.Request ) (* http.Response , error ) {
1764-
17651767 sd := autorest .GetSendDecorators (req .Context (), autorest .DoRetryForStatusCodes (client .RetryAttempts , client .RetryDuration , autorest .StatusCodesForRetry ... ))
17661768 return autorest .SendWithSender (client , req , sd ... )
17671769}
0 commit comments