mirror of
https://github.com/seaweedfs/seaweedfs.git
synced 2024-01-19 02:48:24 +00:00
go fmt
This commit is contained in:
parent
37a3628b2e
commit
ed0acd1722
|
@ -48,7 +48,7 @@ func (iam *IdentityAccessManagement) reqSignatureV4Verify(r *http.Request) (*Ide
|
||||||
const (
|
const (
|
||||||
emptySHA256 = "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855"
|
emptySHA256 = "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855"
|
||||||
streamingContentSHA256 = "STREAMING-AWS4-HMAC-SHA256-PAYLOAD"
|
streamingContentSHA256 = "STREAMING-AWS4-HMAC-SHA256-PAYLOAD"
|
||||||
signV4ChunkedAlgorithm = "AWS4-HMAC-SHA256-PAYLOAD"
|
signV4ChunkedAlgorithm = "AWS4-HMAC-SHA256-PAYLOAD"
|
||||||
|
|
||||||
// http Header "x-amz-content-sha256" == "UNSIGNED-PAYLOAD" indicates that the
|
// http Header "x-amz-content-sha256" == "UNSIGNED-PAYLOAD" indicates that the
|
||||||
// client did not calculate sha256 of the payload.
|
// client did not calculate sha256 of the payload.
|
||||||
|
|
|
@ -54,7 +54,6 @@ func TestIsRequestPresignedSignatureV4(t *testing.T) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// Tests is requested authenticated function, tests replies for s3 errors.
|
// Tests is requested authenticated function, tests replies for s3 errors.
|
||||||
func TestIsReqAuthenticated(t *testing.T) {
|
func TestIsReqAuthenticated(t *testing.T) {
|
||||||
iam := NewIdentityAccessManagement("", "")
|
iam := NewIdentityAccessManagement("", "")
|
||||||
|
|
|
@ -26,7 +26,7 @@ func isRequestSignatureV4(r *http.Request) bool {
|
||||||
// Verify if request has AWS Signature Version '2'.
|
// Verify if request has AWS Signature Version '2'.
|
||||||
func isRequestSignatureV2(r *http.Request) bool {
|
func isRequestSignatureV2(r *http.Request) bool {
|
||||||
return !strings.HasPrefix(r.Header.Get("Authorization"), signV4Algorithm) &&
|
return !strings.HasPrefix(r.Header.Get("Authorization"), signV4Algorithm) &&
|
||||||
strings.HasPrefix(r.Header.Get("Authorization"), signV2Algorithm)
|
strings.HasPrefix(r.Header.Get("Authorization"), signV2Algorithm)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Verify if request has AWS PreSign Version '4'.
|
// Verify if request has AWS PreSign Version '4'.
|
||||||
|
|
|
@ -63,7 +63,7 @@ func (c *commandFsMv) Do(args []string, commandEnv *CommandEnv, writer io.Writer
|
||||||
var targetDir, targetName string
|
var targetDir, targetName string
|
||||||
|
|
||||||
// moving a file or folder
|
// moving a file or folder
|
||||||
if err == nil && respDestinationLookupEntry.Entry!= nil && respDestinationLookupEntry.Entry.IsDirectory {
|
if err == nil && respDestinationLookupEntry.Entry != nil && respDestinationLookupEntry.Entry.IsDirectory {
|
||||||
// to a directory
|
// to a directory
|
||||||
targetDir = filepath.ToSlash(filepath.Join(destinationDir, destinationName))
|
targetDir = filepath.ToSlash(filepath.Join(destinationDir, destinationName))
|
||||||
targetName = sourceName
|
targetName = sourceName
|
||||||
|
|
|
@ -358,7 +358,7 @@ func (s *Store) ConfigureVolume(i needle.VolumeId, replication string) error {
|
||||||
}
|
}
|
||||||
// load, modify, save
|
// load, modify, save
|
||||||
baseFileName := strings.TrimSuffix(fileInfo.Name(), filepath.Ext(fileInfo.Name()))
|
baseFileName := strings.TrimSuffix(fileInfo.Name(), filepath.Ext(fileInfo.Name()))
|
||||||
vifFile := filepath.Join(location.Directory, baseFileName + ".vif")
|
vifFile := filepath.Join(location.Directory, baseFileName+".vif")
|
||||||
volumeInfo, _, err := pb.MaybeLoadVolumeInfo(vifFile)
|
volumeInfo, _, err := pb.MaybeLoadVolumeInfo(vifFile)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return fmt.Errorf("volume %d fail to load vif", i)
|
return fmt.Errorf("volume %d fail to load vif", i)
|
||||||
|
|
|
@ -37,7 +37,7 @@ func (v *Volume) maybeWriteSuperBlock() error {
|
||||||
|
|
||||||
func (v *Volume) readSuperBlock() (err error) {
|
func (v *Volume) readSuperBlock() (err error) {
|
||||||
v.SuperBlock, err = super_block.ReadSuperBlock(v.DataBackend)
|
v.SuperBlock, err = super_block.ReadSuperBlock(v.DataBackend)
|
||||||
if v.volumeInfo != nil && v.volumeInfo.Replication != ""{
|
if v.volumeInfo != nil && v.volumeInfo.Replication != "" {
|
||||||
if replication, err := super_block.NewReplicaPlacementFromString(v.volumeInfo.Replication); err != nil {
|
if replication, err := super_block.NewReplicaPlacementFromString(v.volumeInfo.Replication); err != nil {
|
||||||
return fmt.Errorf("Error parse volume %d replication %s : %v", v.Id, v.volumeInfo.Replication, err)
|
return fmt.Errorf("Error parse volume %d replication %s : %v", v.Id, v.volumeInfo.Replication, err)
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -29,7 +29,7 @@ func NewGrpcServer(opts ...grpc.ServerOption) *grpc.Server {
|
||||||
Time: 10 * time.Second, // wait time before ping if no activity
|
Time: 10 * time.Second, // wait time before ping if no activity
|
||||||
Timeout: 20 * time.Second, // ping timeout
|
Timeout: 20 * time.Second, // ping timeout
|
||||||
}), grpc.KeepaliveEnforcementPolicy(keepalive.EnforcementPolicy{
|
}), grpc.KeepaliveEnforcementPolicy(keepalive.EnforcementPolicy{
|
||||||
MinTime: 60 * time.Second, // min time a client should wait before sending a ping
|
MinTime: 60 * time.Second, // min time a client should wait before sending a ping
|
||||||
PermitWithoutStream: true,
|
PermitWithoutStream: true,
|
||||||
}))
|
}))
|
||||||
for _, opt := range opts {
|
for _, opt := range opts {
|
||||||
|
@ -47,8 +47,8 @@ func GrpcDial(ctx context.Context, address string, opts ...grpc.DialOption) (*gr
|
||||||
options = append(options,
|
options = append(options,
|
||||||
// grpc.WithInsecure(),
|
// grpc.WithInsecure(),
|
||||||
grpc.WithKeepaliveParams(keepalive.ClientParameters{
|
grpc.WithKeepaliveParams(keepalive.ClientParameters{
|
||||||
Time: 30 * time.Second, // client ping server if no activity for this long
|
Time: 30 * time.Second, // client ping server if no activity for this long
|
||||||
Timeout: 20 * time.Second,
|
Timeout: 20 * time.Second,
|
||||||
PermitWithoutStream: true,
|
PermitWithoutStream: true,
|
||||||
}))
|
}))
|
||||||
for _, opt := range opts {
|
for _, opt := range opts {
|
||||||
|
|
Loading…
Reference in a new issue