-
Notifications
You must be signed in to change notification settings - Fork 69
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Vendor the azblob 0.6.0 dependency so customers can upgrade to later …
…blobs packages (#262) * vendoring 0.6.0 of azure-storage-blob-go * updating internal references * Attempting internal vendoring for some pieces, public interface coming from 'azblob'. * slight modifications * linter clean-up * skip lint and gocyclo vendored azblob * fix additional formatting * skip gocyclo and linting azblob in integration tests * use gocyclo ignore instead of finding files * Even though they're the vendored and non-vendored azblob's ServiceCodeTypes are strings they don't "match" when it comes to determining if they're the same type. Aliasing should work just fine here. * fix incorrect comment * Update version and changelog Co-authored-by: ripark <ripark@microsoft.com> Co-authored-by: Joel Hendrix <jhendrix@microsoft.com>
- Loading branch information
1 parent
d88c0a0
commit adc9788
Showing
52 changed files
with
14,757 additions
and
53 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
MIT License | ||
|
||
Copyright (c) Microsoft Corporation. All rights reserved. | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in all | ||
copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
SOFTWARE |
65 changes: 65 additions & 0 deletions
65
internal/azure-storage-blob-go/azblob/access_conditions.go
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
package azblob | ||
|
||
import ( | ||
"time" | ||
) | ||
|
||
// ModifiedAccessConditions identifies standard HTTP access conditions which you optionally set. | ||
type ModifiedAccessConditions struct { | ||
IfModifiedSince time.Time | ||
IfUnmodifiedSince time.Time | ||
IfMatch ETag | ||
IfNoneMatch ETag | ||
} | ||
|
||
// pointers is for internal infrastructure. It returns the fields as pointers. | ||
func (ac ModifiedAccessConditions) pointers() (ims *time.Time, ius *time.Time, ime *ETag, inme *ETag) { | ||
if !ac.IfModifiedSince.IsZero() { | ||
ims = &ac.IfModifiedSince | ||
} | ||
if !ac.IfUnmodifiedSince.IsZero() { | ||
ius = &ac.IfUnmodifiedSince | ||
} | ||
if ac.IfMatch != ETagNone { | ||
ime = &ac.IfMatch | ||
} | ||
if ac.IfNoneMatch != ETagNone { | ||
inme = &ac.IfNoneMatch | ||
} | ||
return | ||
} | ||
|
||
// ContainerAccessConditions identifies container-specific access conditions which you optionally set. | ||
type ContainerAccessConditions struct { | ||
ModifiedAccessConditions | ||
LeaseAccessConditions | ||
} | ||
|
||
// BlobAccessConditions identifies blob-specific access conditions which you optionally set. | ||
type BlobAccessConditions struct { | ||
ModifiedAccessConditions | ||
LeaseAccessConditions | ||
} | ||
|
||
// LeaseAccessConditions identifies lease access conditions for a container or blob which you optionally set. | ||
type LeaseAccessConditions struct { | ||
LeaseID string | ||
} | ||
|
||
// pointers is for internal infrastructure. It returns the fields as pointers. | ||
func (ac LeaseAccessConditions) pointers() (leaseID *string) { | ||
if ac.LeaseID != "" { | ||
leaseID = &ac.LeaseID | ||
} | ||
return | ||
} | ||
|
||
/* | ||
// getInt32 is for internal infrastructure. It is used with access condition values where | ||
// 0 (the default setting) is meaningful. The library interprets 0 as do not send the header | ||
// and the privately-storage field in the access condition object is stored as +1 higher than desired. | ||
// THis method returns true, if the value is > 0 (explicitly set) and the stored value - 1 (the set desired value). | ||
func getInt32(value int32) (bool, int32) { | ||
return value > 0, value - 1 | ||
} | ||
*/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
package azblob | ||
|
||
import "sync/atomic" | ||
|
||
// AtomicMorpherInt32 identifies a method passed to and invoked by the AtomicMorphInt32 function. | ||
// The AtomicMorpher callback is passed a startValue and based on this value it returns | ||
// what the new value should be and the result that AtomicMorph should return to its caller. | ||
type atomicMorpherInt32 func(startVal int32) (val int32, morphResult interface{}) | ||
|
||
const targetAndMorpherMustNotBeNil = "target and morpher must not be nil" | ||
|
||
// AtomicMorph atomically morphs target in to new value (and result) as indicated bythe AtomicMorpher callback function. | ||
func atomicMorphInt32(target *int32, morpher atomicMorpherInt32) interface{} { | ||
for { | ||
currentVal := atomic.LoadInt32(target) | ||
desiredVal, morphResult := morpher(currentVal) | ||
if atomic.CompareAndSwapInt32(target, currentVal, desiredVal) { | ||
return morphResult | ||
} | ||
} | ||
} | ||
|
||
// AtomicMorpherUint32 identifies a method passed to and invoked by the AtomicMorph function. | ||
// The AtomicMorpher callback is passed a startValue and based on this value it returns | ||
// what the new value should be and the result that AtomicMorph should return to its caller. | ||
type atomicMorpherUint32 func(startVal uint32) (val uint32, morphResult interface{}) | ||
|
||
// AtomicMorph atomically morphs target in to new value (and result) as indicated bythe AtomicMorpher callback function. | ||
func atomicMorphUint32(target *uint32, morpher atomicMorpherUint32) interface{} { | ||
for { | ||
currentVal := atomic.LoadUint32(target) | ||
desiredVal, morphResult := morpher(currentVal) | ||
if atomic.CompareAndSwapUint32(target, currentVal, desiredVal) { | ||
return morphResult | ||
} | ||
} | ||
} | ||
|
||
// AtomicMorpherUint64 identifies a method passed to and invoked by the AtomicMorphUint64 function. | ||
// The AtomicMorpher callback is passed a startValue and based on this value it returns | ||
// what the new value should be and the result that AtomicMorph should return to its caller. | ||
type atomicMorpherInt64 func(startVal int64) (val int64, morphResult interface{}) | ||
|
||
// AtomicMorph atomically morphs target in to new value (and result) as indicated bythe AtomicMorpher callback function. | ||
func atomicMorphInt64(target *int64, morpher atomicMorpherInt64) interface{} { | ||
for { | ||
currentVal := atomic.LoadInt64(target) | ||
desiredVal, morphResult := morpher(currentVal) | ||
if atomic.CompareAndSwapInt64(target, currentVal, desiredVal) { | ||
return morphResult | ||
} | ||
} | ||
} | ||
|
||
// AtomicMorpherUint64 identifies a method passed to and invoked by the AtomicMorphUint64 function. | ||
// The AtomicMorpher callback is passed a startValue and based on this value it returns | ||
// what the new value should be and the result that AtomicMorph should return to its caller. | ||
type atomicMorpherUint64 func(startVal uint64) (val uint64, morphResult interface{}) | ||
|
||
// AtomicMorph atomically morphs target in to new value (and result) as indicated bythe AtomicMorpher callback function. | ||
func atomicMorphUint64(target *uint64, morpher atomicMorpherUint64) interface{} { | ||
for { | ||
currentVal := atomic.LoadUint64(target) | ||
desiredVal, morphResult := morpher(currentVal) | ||
if atomic.CompareAndSwapUint64(target, currentVal, desiredVal) { | ||
return morphResult | ||
} | ||
} | ||
} |
Oops, something went wrong.