planetscale 0.2.0 → 0.3.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.buildkite/pipeline.yml +21 -0
- data/.github/workflows/ci.yml +9 -1
- data/.github/workflows/gem-push.yml +9 -2
- data/.licenses/go/github.com/matoous/go-nanoid/v2.dep.yml +34 -0
- data/.licenses/go/github.com/planetscale/planetscale-go/planetscale.dep.yml +56 -3
- data/.licenses/go/github.com/planetscale/sql-proxy/proxy.dep.yml +205 -172
- data/.licenses/go/go.uber.org/zap/buffer.dep.yml +1 -1
- data/.licenses/go/go.uber.org/zap/internal/bufferpool.dep.yml +1 -1
- data/.licenses/go/go.uber.org/zap/internal/color.dep.yml +1 -1
- data/.licenses/go/go.uber.org/zap/internal/exit.dep.yml +1 -1
- data/.licenses/go/go.uber.org/zap/zapcore.dep.yml +1 -1
- data/.licenses/go/go.uber.org/zap.dep.yml +1 -1
- data/README.md +11 -8
- data/controller.go +24 -26
- data/go.mod +4 -3
- data/go.sum +42 -27
- data/lib/generators/planetscale/install_generator.rb +8 -6
- data/lib/planetscale/version.rb +1 -1
- data/lib/planetscale.rb +14 -15
- data/planetscale.gemspec +2 -2
- data/proxy/planetscale-darwin.h +1 -1
- data/proxy/planetscale-darwin.so +0 -0
- data/proxy/planetscale-linux.h +1 -1
- data/proxy/planetscale-linux.so +0 -0
- data/proxy.go +1 -5
- metadata +6 -342
- data/vendor/github.com/armon/circbuf/.gitignore +0 -22
- data/vendor/github.com/armon/circbuf/LICENSE +0 -20
- data/vendor/github.com/armon/circbuf/README.md +0 -28
- data/vendor/github.com/armon/circbuf/circbuf.go +0 -92
- data/vendor/github.com/armon/circbuf/go.mod +0 -1
- data/vendor/github.com/golang/protobuf/AUTHORS +0 -3
- data/vendor/github.com/golang/protobuf/CONTRIBUTORS +0 -3
- data/vendor/github.com/golang/protobuf/LICENSE +0 -28
- data/vendor/github.com/golang/protobuf/proto/buffer.go +0 -324
- data/vendor/github.com/golang/protobuf/proto/defaults.go +0 -63
- data/vendor/github.com/golang/protobuf/proto/deprecated.go +0 -113
- data/vendor/github.com/golang/protobuf/proto/discard.go +0 -58
- data/vendor/github.com/golang/protobuf/proto/extensions.go +0 -356
- data/vendor/github.com/golang/protobuf/proto/properties.go +0 -306
- data/vendor/github.com/golang/protobuf/proto/proto.go +0 -167
- data/vendor/github.com/golang/protobuf/proto/registry.go +0 -317
- data/vendor/github.com/golang/protobuf/proto/text_decode.go +0 -801
- data/vendor/github.com/golang/protobuf/proto/text_encode.go +0 -560
- data/vendor/github.com/golang/protobuf/proto/wire.go +0 -78
- data/vendor/github.com/golang/protobuf/proto/wrappers.go +0 -34
- data/vendor/github.com/gorilla/mux/AUTHORS +0 -8
- data/vendor/github.com/gorilla/mux/LICENSE +0 -27
- data/vendor/github.com/gorilla/mux/README.md +0 -805
- data/vendor/github.com/gorilla/mux/doc.go +0 -306
- data/vendor/github.com/gorilla/mux/go.mod +0 -3
- data/vendor/github.com/gorilla/mux/middleware.go +0 -74
- data/vendor/github.com/gorilla/mux/mux.go +0 -606
- data/vendor/github.com/gorilla/mux/regexp.go +0 -388
- data/vendor/github.com/gorilla/mux/route.go +0 -736
- data/vendor/github.com/gorilla/mux/test_helpers.go +0 -19
- data/vendor/github.com/hashicorp/go-cleanhttp/LICENSE +0 -363
- data/vendor/github.com/hashicorp/go-cleanhttp/README.md +0 -30
- data/vendor/github.com/hashicorp/go-cleanhttp/cleanhttp.go +0 -58
- data/vendor/github.com/hashicorp/go-cleanhttp/doc.go +0 -20
- data/vendor/github.com/hashicorp/go-cleanhttp/go.mod +0 -3
- data/vendor/github.com/hashicorp/go-cleanhttp/handlers.go +0 -48
- data/vendor/github.com/mitchellh/go-homedir/LICENSE +0 -21
- data/vendor/github.com/mitchellh/go-homedir/README.md +0 -14
- data/vendor/github.com/mitchellh/go-homedir/go.mod +0 -1
- data/vendor/github.com/mitchellh/go-homedir/homedir.go +0 -167
- data/vendor/github.com/pkg/errors/.gitignore +0 -24
- data/vendor/github.com/pkg/errors/.travis.yml +0 -10
- data/vendor/github.com/pkg/errors/LICENSE +0 -23
- data/vendor/github.com/pkg/errors/Makefile +0 -44
- data/vendor/github.com/pkg/errors/README.md +0 -59
- data/vendor/github.com/pkg/errors/appveyor.yml +0 -32
- data/vendor/github.com/pkg/errors/errors.go +0 -288
- data/vendor/github.com/pkg/errors/go113.go +0 -38
- data/vendor/github.com/pkg/errors/stack.go +0 -177
- data/vendor/github.com/planetscale/planetscale-go/planetscale/backups.go +0 -139
- data/vendor/github.com/planetscale/planetscale-go/planetscale/branches.go +0 -258
- data/vendor/github.com/planetscale/planetscale-go/planetscale/certs.go +0 -142
- data/vendor/github.com/planetscale/planetscale-go/planetscale/client.go +0 -305
- data/vendor/github.com/planetscale/planetscale-go/planetscale/databases.go +0 -131
- data/vendor/github.com/planetscale/planetscale-go/planetscale/deploy_requests.go +0 -368
- data/vendor/github.com/planetscale/planetscale-go/planetscale/organizations.go +0 -78
- data/vendor/github.com/planetscale/planetscale-go/planetscale/service_tokens.go +0 -163
- data/vendor/github.com/planetscale/sql-proxy/proxy/client.go +0 -467
- data/vendor/github.com/planetscale/sql-proxy/proxy/tls_cache.go +0 -73
- data/vendor/go.uber.org/atomic/.codecov.yml +0 -19
- data/vendor/go.uber.org/atomic/.gitignore +0 -12
- data/vendor/go.uber.org/atomic/.travis.yml +0 -27
- data/vendor/go.uber.org/atomic/CHANGELOG.md +0 -76
- data/vendor/go.uber.org/atomic/LICENSE.txt +0 -19
- data/vendor/go.uber.org/atomic/Makefile +0 -78
- data/vendor/go.uber.org/atomic/README.md +0 -63
- data/vendor/go.uber.org/atomic/bool.go +0 -81
- data/vendor/go.uber.org/atomic/bool_ext.go +0 -53
- data/vendor/go.uber.org/atomic/doc.go +0 -23
- data/vendor/go.uber.org/atomic/duration.go +0 -82
- data/vendor/go.uber.org/atomic/duration_ext.go +0 -40
- data/vendor/go.uber.org/atomic/error.go +0 -51
- data/vendor/go.uber.org/atomic/error_ext.go +0 -39
- data/vendor/go.uber.org/atomic/float64.go +0 -76
- data/vendor/go.uber.org/atomic/float64_ext.go +0 -47
- data/vendor/go.uber.org/atomic/gen.go +0 -26
- data/vendor/go.uber.org/atomic/go.mod +0 -8
- data/vendor/go.uber.org/atomic/go.sum +0 -9
- data/vendor/go.uber.org/atomic/int32.go +0 -102
- data/vendor/go.uber.org/atomic/int64.go +0 -102
- data/vendor/go.uber.org/atomic/nocmp.go +0 -35
- data/vendor/go.uber.org/atomic/string.go +0 -54
- data/vendor/go.uber.org/atomic/string_ext.go +0 -43
- data/vendor/go.uber.org/atomic/uint32.go +0 -102
- data/vendor/go.uber.org/atomic/uint64.go +0 -102
- data/vendor/go.uber.org/atomic/value.go +0 -31
- data/vendor/go.uber.org/multierr/.codecov.yml +0 -15
- data/vendor/go.uber.org/multierr/.gitignore +0 -4
- data/vendor/go.uber.org/multierr/.travis.yml +0 -23
- data/vendor/go.uber.org/multierr/CHANGELOG.md +0 -60
- data/vendor/go.uber.org/multierr/LICENSE.txt +0 -19
- data/vendor/go.uber.org/multierr/Makefile +0 -42
- data/vendor/go.uber.org/multierr/README.md +0 -23
- data/vendor/go.uber.org/multierr/error.go +0 -449
- data/vendor/go.uber.org/multierr/glide.yaml +0 -8
- data/vendor/go.uber.org/multierr/go.mod +0 -8
- data/vendor/go.uber.org/multierr/go.sum +0 -11
- data/vendor/go.uber.org/multierr/go113.go +0 -52
- data/vendor/go.uber.org/zap/.codecov.yml +0 -17
- data/vendor/go.uber.org/zap/.gitignore +0 -32
- data/vendor/go.uber.org/zap/.readme.tmpl +0 -109
- data/vendor/go.uber.org/zap/.travis.yml +0 -23
- data/vendor/go.uber.org/zap/CHANGELOG.md +0 -432
- data/vendor/go.uber.org/zap/CODE_OF_CONDUCT.md +0 -75
- data/vendor/go.uber.org/zap/CONTRIBUTING.md +0 -81
- data/vendor/go.uber.org/zap/FAQ.md +0 -156
- data/vendor/go.uber.org/zap/LICENSE.txt +0 -19
- data/vendor/go.uber.org/zap/Makefile +0 -63
- data/vendor/go.uber.org/zap/README.md +0 -134
- data/vendor/go.uber.org/zap/array.go +0 -320
- data/vendor/go.uber.org/zap/buffer/buffer.go +0 -123
- data/vendor/go.uber.org/zap/buffer/pool.go +0 -49
- data/vendor/go.uber.org/zap/checklicense.sh +0 -17
- data/vendor/go.uber.org/zap/config.go +0 -264
- data/vendor/go.uber.org/zap/doc.go +0 -113
- data/vendor/go.uber.org/zap/encoder.go +0 -79
- data/vendor/go.uber.org/zap/error.go +0 -80
- data/vendor/go.uber.org/zap/field.go +0 -539
- data/vendor/go.uber.org/zap/flag.go +0 -39
- data/vendor/go.uber.org/zap/glide.yaml +0 -34
- data/vendor/go.uber.org/zap/global.go +0 -168
- data/vendor/go.uber.org/zap/global_go112.go +0 -26
- data/vendor/go.uber.org/zap/global_prego112.go +0 -26
- data/vendor/go.uber.org/zap/go.mod +0 -13
- data/vendor/go.uber.org/zap/go.sum +0 -56
- data/vendor/go.uber.org/zap/http_handler.go +0 -81
- data/vendor/go.uber.org/zap/internal/bufferpool/bufferpool.go +0 -31
- data/vendor/go.uber.org/zap/internal/color/color.go +0 -44
- data/vendor/go.uber.org/zap/internal/exit/exit.go +0 -64
- data/vendor/go.uber.org/zap/level.go +0 -132
- data/vendor/go.uber.org/zap/logger.go +0 -344
- data/vendor/go.uber.org/zap/options.go +0 -140
- data/vendor/go.uber.org/zap/sink.go +0 -161
- data/vendor/go.uber.org/zap/stacktrace.go +0 -85
- data/vendor/go.uber.org/zap/sugar.go +0 -304
- data/vendor/go.uber.org/zap/time.go +0 -27
- data/vendor/go.uber.org/zap/writer.go +0 -99
- data/vendor/go.uber.org/zap/zapcore/console_encoder.go +0 -161
- data/vendor/go.uber.org/zap/zapcore/core.go +0 -113
- data/vendor/go.uber.org/zap/zapcore/doc.go +0 -24
- data/vendor/go.uber.org/zap/zapcore/encoder.go +0 -443
- data/vendor/go.uber.org/zap/zapcore/entry.go +0 -264
- data/vendor/go.uber.org/zap/zapcore/error.go +0 -115
- data/vendor/go.uber.org/zap/zapcore/field.go +0 -227
- data/vendor/go.uber.org/zap/zapcore/hook.go +0 -68
- data/vendor/go.uber.org/zap/zapcore/increase_level.go +0 -66
- data/vendor/go.uber.org/zap/zapcore/json_encoder.go +0 -534
- data/vendor/go.uber.org/zap/zapcore/level.go +0 -175
- data/vendor/go.uber.org/zap/zapcore/level_strings.go +0 -46
- data/vendor/go.uber.org/zap/zapcore/marshaler.go +0 -61
- data/vendor/go.uber.org/zap/zapcore/memory_encoder.go +0 -179
- data/vendor/go.uber.org/zap/zapcore/sampler.go +0 -208
- data/vendor/go.uber.org/zap/zapcore/tee.go +0 -81
- data/vendor/go.uber.org/zap/zapcore/write_syncer.go +0 -123
- data/vendor/golang.org/x/net/AUTHORS +0 -3
- data/vendor/golang.org/x/net/CONTRIBUTORS +0 -3
- data/vendor/golang.org/x/net/LICENSE +0 -27
- data/vendor/golang.org/x/net/PATENTS +0 -22
- data/vendor/golang.org/x/net/context/context.go +0 -56
- data/vendor/golang.org/x/net/context/ctxhttp/ctxhttp.go +0 -71
- data/vendor/golang.org/x/net/context/go17.go +0 -73
- data/vendor/golang.org/x/net/context/go19.go +0 -21
- data/vendor/golang.org/x/net/context/pre_go17.go +0 -301
- data/vendor/golang.org/x/net/context/pre_go19.go +0 -110
- data/vendor/golang.org/x/oauth2/.travis.yml +0 -13
- data/vendor/golang.org/x/oauth2/AUTHORS +0 -3
- data/vendor/golang.org/x/oauth2/CONTRIBUTING.md +0 -26
- data/vendor/golang.org/x/oauth2/CONTRIBUTORS +0 -3
- data/vendor/golang.org/x/oauth2/LICENSE +0 -27
- data/vendor/golang.org/x/oauth2/README.md +0 -36
- data/vendor/golang.org/x/oauth2/go.mod +0 -9
- data/vendor/golang.org/x/oauth2/go.sum +0 -361
- data/vendor/golang.org/x/oauth2/internal/client_appengine.go +0 -14
- data/vendor/golang.org/x/oauth2/internal/doc.go +0 -6
- data/vendor/golang.org/x/oauth2/internal/oauth2.go +0 -37
- data/vendor/golang.org/x/oauth2/internal/token.go +0 -294
- data/vendor/golang.org/x/oauth2/internal/transport.go +0 -33
- data/vendor/golang.org/x/oauth2/oauth2.go +0 -381
- data/vendor/golang.org/x/oauth2/token.go +0 -178
- data/vendor/golang.org/x/oauth2/transport.go +0 -89
- data/vendor/google.golang.org/appengine/LICENSE +0 -202
- data/vendor/google.golang.org/appengine/internal/api.go +0 -678
- data/vendor/google.golang.org/appengine/internal/api_classic.go +0 -169
- data/vendor/google.golang.org/appengine/internal/api_common.go +0 -123
- data/vendor/google.golang.org/appengine/internal/app_id.go +0 -28
- data/vendor/google.golang.org/appengine/internal/base/api_base.pb.go +0 -308
- data/vendor/google.golang.org/appengine/internal/base/api_base.proto +0 -33
- data/vendor/google.golang.org/appengine/internal/datastore/datastore_v3.pb.go +0 -4367
- data/vendor/google.golang.org/appengine/internal/datastore/datastore_v3.proto +0 -551
- data/vendor/google.golang.org/appengine/internal/identity.go +0 -55
- data/vendor/google.golang.org/appengine/internal/identity_classic.go +0 -61
- data/vendor/google.golang.org/appengine/internal/identity_flex.go +0 -11
- data/vendor/google.golang.org/appengine/internal/identity_vm.go +0 -134
- data/vendor/google.golang.org/appengine/internal/internal.go +0 -110
- data/vendor/google.golang.org/appengine/internal/log/log_service.pb.go +0 -1313
- data/vendor/google.golang.org/appengine/internal/log/log_service.proto +0 -150
- data/vendor/google.golang.org/appengine/internal/main.go +0 -16
- data/vendor/google.golang.org/appengine/internal/main_common.go +0 -7
- data/vendor/google.golang.org/appengine/internal/main_vm.go +0 -69
- data/vendor/google.golang.org/appengine/internal/metadata.go +0 -60
- data/vendor/google.golang.org/appengine/internal/net.go +0 -56
- data/vendor/google.golang.org/appengine/internal/regen.sh +0 -40
- data/vendor/google.golang.org/appengine/internal/remote_api/remote_api.pb.go +0 -361
- data/vendor/google.golang.org/appengine/internal/remote_api/remote_api.proto +0 -44
- data/vendor/google.golang.org/appengine/internal/transaction.go +0 -115
- data/vendor/google.golang.org/appengine/internal/urlfetch/urlfetch_service.pb.go +0 -527
- data/vendor/google.golang.org/appengine/internal/urlfetch/urlfetch_service.proto +0 -64
- data/vendor/google.golang.org/appengine/urlfetch/urlfetch.go +0 -210
- data/vendor/google.golang.org/protobuf/AUTHORS +0 -3
- data/vendor/google.golang.org/protobuf/CONTRIBUTORS +0 -3
- data/vendor/google.golang.org/protobuf/LICENSE +0 -27
- data/vendor/google.golang.org/protobuf/PATENTS +0 -22
- data/vendor/google.golang.org/protobuf/encoding/prototext/decode.go +0 -773
- data/vendor/google.golang.org/protobuf/encoding/prototext/doc.go +0 -7
- data/vendor/google.golang.org/protobuf/encoding/prototext/encode.go +0 -371
- data/vendor/google.golang.org/protobuf/encoding/protowire/wire.go +0 -538
- data/vendor/google.golang.org/protobuf/internal/descfmt/stringer.go +0 -318
- data/vendor/google.golang.org/protobuf/internal/descopts/options.go +0 -29
- data/vendor/google.golang.org/protobuf/internal/detrand/rand.go +0 -69
- data/vendor/google.golang.org/protobuf/internal/encoding/defval/default.go +0 -213
- data/vendor/google.golang.org/protobuf/internal/encoding/messageset/messageset.go +0 -241
- data/vendor/google.golang.org/protobuf/internal/encoding/tag/tag.go +0 -207
- data/vendor/google.golang.org/protobuf/internal/encoding/text/decode.go +0 -665
- data/vendor/google.golang.org/protobuf/internal/encoding/text/decode_number.go +0 -190
- data/vendor/google.golang.org/protobuf/internal/encoding/text/decode_string.go +0 -161
- data/vendor/google.golang.org/protobuf/internal/encoding/text/decode_token.go +0 -373
- data/vendor/google.golang.org/protobuf/internal/encoding/text/doc.go +0 -29
- data/vendor/google.golang.org/protobuf/internal/encoding/text/encode.go +0 -265
- data/vendor/google.golang.org/protobuf/internal/errors/errors.go +0 -89
- data/vendor/google.golang.org/protobuf/internal/errors/is_go112.go +0 -39
- data/vendor/google.golang.org/protobuf/internal/errors/is_go113.go +0 -12
- data/vendor/google.golang.org/protobuf/internal/filedesc/build.go +0 -158
- data/vendor/google.golang.org/protobuf/internal/filedesc/desc.go +0 -631
- data/vendor/google.golang.org/protobuf/internal/filedesc/desc_init.go +0 -471
- data/vendor/google.golang.org/protobuf/internal/filedesc/desc_lazy.go +0 -704
- data/vendor/google.golang.org/protobuf/internal/filedesc/desc_list.go +0 -450
- data/vendor/google.golang.org/protobuf/internal/filedesc/desc_list_gen.go +0 -356
- data/vendor/google.golang.org/protobuf/internal/filedesc/placeholder.go +0 -107
- data/vendor/google.golang.org/protobuf/internal/filetype/build.go +0 -297
- data/vendor/google.golang.org/protobuf/internal/flags/flags.go +0 -24
- data/vendor/google.golang.org/protobuf/internal/flags/proto_legacy_disable.go +0 -9
- data/vendor/google.golang.org/protobuf/internal/flags/proto_legacy_enable.go +0 -9
- data/vendor/google.golang.org/protobuf/internal/genid/any_gen.go +0 -34
- data/vendor/google.golang.org/protobuf/internal/genid/api_gen.go +0 -106
- data/vendor/google.golang.org/protobuf/internal/genid/descriptor_gen.go +0 -829
- data/vendor/google.golang.org/protobuf/internal/genid/doc.go +0 -11
- data/vendor/google.golang.org/protobuf/internal/genid/duration_gen.go +0 -34
- data/vendor/google.golang.org/protobuf/internal/genid/empty_gen.go +0 -19
- data/vendor/google.golang.org/protobuf/internal/genid/field_mask_gen.go +0 -31
- data/vendor/google.golang.org/protobuf/internal/genid/goname.go +0 -25
- data/vendor/google.golang.org/protobuf/internal/genid/map_entry.go +0 -16
- data/vendor/google.golang.org/protobuf/internal/genid/source_context_gen.go +0 -31
- data/vendor/google.golang.org/protobuf/internal/genid/struct_gen.go +0 -116
- data/vendor/google.golang.org/protobuf/internal/genid/timestamp_gen.go +0 -34
- data/vendor/google.golang.org/protobuf/internal/genid/type_gen.go +0 -184
- data/vendor/google.golang.org/protobuf/internal/genid/wrappers.go +0 -13
- data/vendor/google.golang.org/protobuf/internal/genid/wrappers_gen.go +0 -175
- data/vendor/google.golang.org/protobuf/internal/impl/api_export.go +0 -177
- data/vendor/google.golang.org/protobuf/internal/impl/checkinit.go +0 -141
- data/vendor/google.golang.org/protobuf/internal/impl/codec_extension.go +0 -223
- data/vendor/google.golang.org/protobuf/internal/impl/codec_field.go +0 -830
- data/vendor/google.golang.org/protobuf/internal/impl/codec_gen.go +0 -5637
- data/vendor/google.golang.org/protobuf/internal/impl/codec_map.go +0 -388
- data/vendor/google.golang.org/protobuf/internal/impl/codec_map_go111.go +0 -37
- data/vendor/google.golang.org/protobuf/internal/impl/codec_map_go112.go +0 -11
- data/vendor/google.golang.org/protobuf/internal/impl/codec_message.go +0 -217
- data/vendor/google.golang.org/protobuf/internal/impl/codec_messageset.go +0 -123
- data/vendor/google.golang.org/protobuf/internal/impl/codec_reflect.go +0 -209
- data/vendor/google.golang.org/protobuf/internal/impl/codec_tables.go +0 -557
- data/vendor/google.golang.org/protobuf/internal/impl/codec_unsafe.go +0 -17
- data/vendor/google.golang.org/protobuf/internal/impl/convert.go +0 -496
- data/vendor/google.golang.org/protobuf/internal/impl/convert_list.go +0 -141
- data/vendor/google.golang.org/protobuf/internal/impl/convert_map.go +0 -121
- data/vendor/google.golang.org/protobuf/internal/impl/decode.go +0 -276
- data/vendor/google.golang.org/protobuf/internal/impl/encode.go +0 -201
- data/vendor/google.golang.org/protobuf/internal/impl/enum.go +0 -21
- data/vendor/google.golang.org/protobuf/internal/impl/extension.go +0 -156
- data/vendor/google.golang.org/protobuf/internal/impl/legacy_enum.go +0 -219
- data/vendor/google.golang.org/protobuf/internal/impl/legacy_export.go +0 -92
- data/vendor/google.golang.org/protobuf/internal/impl/legacy_extension.go +0 -176
- data/vendor/google.golang.org/protobuf/internal/impl/legacy_file.go +0 -81
- data/vendor/google.golang.org/protobuf/internal/impl/legacy_message.go +0 -558
- data/vendor/google.golang.org/protobuf/internal/impl/merge.go +0 -176
- data/vendor/google.golang.org/protobuf/internal/impl/merge_gen.go +0 -209
- data/vendor/google.golang.org/protobuf/internal/impl/message.go +0 -276
- data/vendor/google.golang.org/protobuf/internal/impl/message_reflect.go +0 -465
- data/vendor/google.golang.org/protobuf/internal/impl/message_reflect_field.go +0 -543
- data/vendor/google.golang.org/protobuf/internal/impl/message_reflect_gen.go +0 -249
- data/vendor/google.golang.org/protobuf/internal/impl/pointer_reflect.go +0 -178
- data/vendor/google.golang.org/protobuf/internal/impl/pointer_unsafe.go +0 -174
- data/vendor/google.golang.org/protobuf/internal/impl/validate.go +0 -576
- data/vendor/google.golang.org/protobuf/internal/impl/weak.go +0 -74
- data/vendor/google.golang.org/protobuf/internal/order/order.go +0 -89
- data/vendor/google.golang.org/protobuf/internal/order/range.go +0 -115
- data/vendor/google.golang.org/protobuf/internal/pragma/pragma.go +0 -29
- data/vendor/google.golang.org/protobuf/internal/set/ints.go +0 -58
- data/vendor/google.golang.org/protobuf/internal/strs/strings.go +0 -196
- data/vendor/google.golang.org/protobuf/internal/strs/strings_pure.go +0 -27
- data/vendor/google.golang.org/protobuf/internal/strs/strings_unsafe.go +0 -94
- data/vendor/google.golang.org/protobuf/internal/version/version.go +0 -79
- data/vendor/google.golang.org/protobuf/proto/checkinit.go +0 -71
- data/vendor/google.golang.org/protobuf/proto/decode.go +0 -278
- data/vendor/google.golang.org/protobuf/proto/decode_gen.go +0 -603
- data/vendor/google.golang.org/protobuf/proto/doc.go +0 -94
- data/vendor/google.golang.org/protobuf/proto/encode.go +0 -319
- data/vendor/google.golang.org/protobuf/proto/encode_gen.go +0 -97
- data/vendor/google.golang.org/protobuf/proto/equal.go +0 -167
- data/vendor/google.golang.org/protobuf/proto/extension.go +0 -92
- data/vendor/google.golang.org/protobuf/proto/merge.go +0 -139
- data/vendor/google.golang.org/protobuf/proto/messageset.go +0 -93
- data/vendor/google.golang.org/protobuf/proto/proto.go +0 -43
- data/vendor/google.golang.org/protobuf/proto/proto_methods.go +0 -19
- data/vendor/google.golang.org/protobuf/proto/proto_reflect.go +0 -19
- data/vendor/google.golang.org/protobuf/proto/reset.go +0 -43
- data/vendor/google.golang.org/protobuf/proto/size.go +0 -97
- data/vendor/google.golang.org/protobuf/proto/size_gen.go +0 -55
- data/vendor/google.golang.org/protobuf/proto/wrappers.go +0 -29
- data/vendor/google.golang.org/protobuf/reflect/protodesc/desc.go +0 -276
- data/vendor/google.golang.org/protobuf/reflect/protodesc/desc_init.go +0 -248
- data/vendor/google.golang.org/protobuf/reflect/protodesc/desc_resolve.go +0 -286
- data/vendor/google.golang.org/protobuf/reflect/protodesc/desc_validate.go +0 -374
- data/vendor/google.golang.org/protobuf/reflect/protodesc/proto.go +0 -252
- data/vendor/google.golang.org/protobuf/reflect/protoreflect/methods.go +0 -77
- data/vendor/google.golang.org/protobuf/reflect/protoreflect/proto.go +0 -504
- data/vendor/google.golang.org/protobuf/reflect/protoreflect/source.go +0 -128
- data/vendor/google.golang.org/protobuf/reflect/protoreflect/source_gen.go +0 -461
- data/vendor/google.golang.org/protobuf/reflect/protoreflect/type.go +0 -665
- data/vendor/google.golang.org/protobuf/reflect/protoreflect/value.go +0 -285
- data/vendor/google.golang.org/protobuf/reflect/protoreflect/value_pure.go +0 -59
- data/vendor/google.golang.org/protobuf/reflect/protoreflect/value_union.go +0 -411
- data/vendor/google.golang.org/protobuf/reflect/protoreflect/value_unsafe.go +0 -98
- data/vendor/google.golang.org/protobuf/reflect/protoregistry/registry.go +0 -869
- data/vendor/google.golang.org/protobuf/runtime/protoiface/legacy.go +0 -15
- data/vendor/google.golang.org/protobuf/runtime/protoiface/methods.go +0 -167
- data/vendor/google.golang.org/protobuf/runtime/protoimpl/impl.go +0 -44
- data/vendor/google.golang.org/protobuf/runtime/protoimpl/version.go +0 -56
- data/vendor/google.golang.org/protobuf/types/descriptorpb/descriptor.pb.go +0 -4039
- data/vendor/modules.txt +0 -79
@@ -1,78 +0,0 @@
|
|
1
|
-
# Directory to place `go install`ed binaries into.
|
2
|
-
export GOBIN ?= $(shell pwd)/bin
|
3
|
-
|
4
|
-
GOLINT = $(GOBIN)/golint
|
5
|
-
GEN_ATOMICINT = $(GOBIN)/gen-atomicint
|
6
|
-
GEN_ATOMICWRAPPER = $(GOBIN)/gen-atomicwrapper
|
7
|
-
STATICCHECK = $(GOBIN)/staticcheck
|
8
|
-
|
9
|
-
GO_FILES ?= $(shell find . '(' -path .git -o -path vendor ')' -prune -o -name '*.go' -print)
|
10
|
-
|
11
|
-
# Also update ignore section in .codecov.yml.
|
12
|
-
COVER_IGNORE_PKGS = \
|
13
|
-
go.uber.org/atomic/internal/gen-atomicint \
|
14
|
-
go.uber.org/atomic/internal/gen-atomicwrapper
|
15
|
-
|
16
|
-
.PHONY: build
|
17
|
-
build:
|
18
|
-
go build ./...
|
19
|
-
|
20
|
-
.PHONY: test
|
21
|
-
test:
|
22
|
-
go test -race ./...
|
23
|
-
|
24
|
-
.PHONY: gofmt
|
25
|
-
gofmt:
|
26
|
-
$(eval FMT_LOG := $(shell mktemp -t gofmt.XXXXX))
|
27
|
-
gofmt -e -s -l $(GO_FILES) > $(FMT_LOG) || true
|
28
|
-
@[ ! -s "$(FMT_LOG)" ] || (echo "gofmt failed:" && cat $(FMT_LOG) && false)
|
29
|
-
|
30
|
-
$(GOLINT):
|
31
|
-
cd tools && go install golang.org/x/lint/golint
|
32
|
-
|
33
|
-
$(STATICCHECK):
|
34
|
-
cd tools && go install honnef.co/go/tools/cmd/staticcheck
|
35
|
-
|
36
|
-
$(GEN_ATOMICWRAPPER): $(wildcard ./internal/gen-atomicwrapper/*)
|
37
|
-
go build -o $@ ./internal/gen-atomicwrapper
|
38
|
-
|
39
|
-
$(GEN_ATOMICINT): $(wildcard ./internal/gen-atomicint/*)
|
40
|
-
go build -o $@ ./internal/gen-atomicint
|
41
|
-
|
42
|
-
.PHONY: golint
|
43
|
-
golint: $(GOLINT)
|
44
|
-
$(GOLINT) ./...
|
45
|
-
|
46
|
-
.PHONY: staticcheck
|
47
|
-
staticcheck: $(STATICCHECK)
|
48
|
-
$(STATICCHECK) ./...
|
49
|
-
|
50
|
-
.PHONY: lint
|
51
|
-
lint: gofmt golint staticcheck generatenodirty
|
52
|
-
|
53
|
-
# comma separated list of packages to consider for code coverage.
|
54
|
-
COVER_PKG = $(shell \
|
55
|
-
go list -find ./... | \
|
56
|
-
grep -v $(foreach pkg,$(COVER_IGNORE_PKGS),-e "^$(pkg)$$") | \
|
57
|
-
paste -sd, -)
|
58
|
-
|
59
|
-
.PHONY: cover
|
60
|
-
cover:
|
61
|
-
go test -coverprofile=cover.out -coverpkg $(COVER_PKG) -v ./...
|
62
|
-
go tool cover -html=cover.out -o cover.html
|
63
|
-
|
64
|
-
.PHONY: generate
|
65
|
-
generate: $(GEN_ATOMICINT) $(GEN_ATOMICWRAPPER)
|
66
|
-
go generate ./...
|
67
|
-
|
68
|
-
.PHONY: generatenodirty
|
69
|
-
generatenodirty:
|
70
|
-
@[ -z "$$(git status --porcelain)" ] || ( \
|
71
|
-
echo "Working tree is dirty. Commit your changes first."; \
|
72
|
-
exit 1 )
|
73
|
-
@make generate
|
74
|
-
@status=$$(git status --porcelain); \
|
75
|
-
[ -z "$$status" ] || ( \
|
76
|
-
echo "Working tree is dirty after `make generate`:"; \
|
77
|
-
echo "$$status"; \
|
78
|
-
echo "Please ensure that the generated code is up-to-date." )
|
@@ -1,63 +0,0 @@
|
|
1
|
-
# atomic [![GoDoc][doc-img]][doc] [![Build Status][ci-img]][ci] [![Coverage Status][cov-img]][cov] [![Go Report Card][reportcard-img]][reportcard]
|
2
|
-
|
3
|
-
Simple wrappers for primitive types to enforce atomic access.
|
4
|
-
|
5
|
-
## Installation
|
6
|
-
|
7
|
-
```shell
|
8
|
-
$ go get -u go.uber.org/atomic@v1
|
9
|
-
```
|
10
|
-
|
11
|
-
### Legacy Import Path
|
12
|
-
|
13
|
-
As of v1.5.0, the import path `go.uber.org/atomic` is the only supported way
|
14
|
-
of using this package. If you are using Go modules, this package will fail to
|
15
|
-
compile with the legacy import path path `github.com/uber-go/atomic`.
|
16
|
-
|
17
|
-
We recommend migrating your code to the new import path but if you're unable
|
18
|
-
to do so, or if your dependencies are still using the old import path, you
|
19
|
-
will have to add a `replace` directive to your `go.mod` file downgrading the
|
20
|
-
legacy import path to an older version.
|
21
|
-
|
22
|
-
```
|
23
|
-
replace github.com/uber-go/atomic => github.com/uber-go/atomic v1.4.0
|
24
|
-
```
|
25
|
-
|
26
|
-
You can do so automatically by running the following command.
|
27
|
-
|
28
|
-
```shell
|
29
|
-
$ go mod edit -replace github.com/uber-go/atomic=github.com/uber-go/atomic@v1.4.0
|
30
|
-
```
|
31
|
-
|
32
|
-
## Usage
|
33
|
-
|
34
|
-
The standard library's `sync/atomic` is powerful, but it's easy to forget which
|
35
|
-
variables must be accessed atomically. `go.uber.org/atomic` preserves all the
|
36
|
-
functionality of the standard library, but wraps the primitive types to
|
37
|
-
provide a safer, more convenient API.
|
38
|
-
|
39
|
-
```go
|
40
|
-
var atom atomic.Uint32
|
41
|
-
atom.Store(42)
|
42
|
-
atom.Sub(2)
|
43
|
-
atom.CAS(40, 11)
|
44
|
-
```
|
45
|
-
|
46
|
-
See the [documentation][doc] for a complete API specification.
|
47
|
-
|
48
|
-
## Development Status
|
49
|
-
|
50
|
-
Stable.
|
51
|
-
|
52
|
-
---
|
53
|
-
|
54
|
-
Released under the [MIT License](LICENSE.txt).
|
55
|
-
|
56
|
-
[doc-img]: https://godoc.org/github.com/uber-go/atomic?status.svg
|
57
|
-
[doc]: https://godoc.org/go.uber.org/atomic
|
58
|
-
[ci-img]: https://travis-ci.com/uber-go/atomic.svg?branch=master
|
59
|
-
[ci]: https://travis-ci.com/uber-go/atomic
|
60
|
-
[cov-img]: https://codecov.io/gh/uber-go/atomic/branch/master/graph/badge.svg
|
61
|
-
[cov]: https://codecov.io/gh/uber-go/atomic
|
62
|
-
[reportcard-img]: https://goreportcard.com/badge/go.uber.org/atomic
|
63
|
-
[reportcard]: https://goreportcard.com/report/go.uber.org/atomic
|
@@ -1,81 +0,0 @@
|
|
1
|
-
// @generated Code generated by gen-atomicwrapper.
|
2
|
-
|
3
|
-
// Copyright (c) 2020 Uber Technologies, Inc.
|
4
|
-
//
|
5
|
-
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
-
// of this software and associated documentation files (the "Software"), to deal
|
7
|
-
// in the Software without restriction, including without limitation the rights
|
8
|
-
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
-
// copies of the Software, and to permit persons to whom the Software is
|
10
|
-
// furnished to do so, subject to the following conditions:
|
11
|
-
//
|
12
|
-
// The above copyright notice and this permission notice shall be included in
|
13
|
-
// all copies or substantial portions of the Software.
|
14
|
-
//
|
15
|
-
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
-
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
-
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
-
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
-
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
-
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
21
|
-
// THE SOFTWARE.
|
22
|
-
|
23
|
-
package atomic
|
24
|
-
|
25
|
-
import (
|
26
|
-
"encoding/json"
|
27
|
-
)
|
28
|
-
|
29
|
-
// Bool is an atomic type-safe wrapper for bool values.
|
30
|
-
type Bool struct {
|
31
|
-
_ nocmp // disallow non-atomic comparison
|
32
|
-
|
33
|
-
v Uint32
|
34
|
-
}
|
35
|
-
|
36
|
-
var _zeroBool bool
|
37
|
-
|
38
|
-
// NewBool creates a new Bool.
|
39
|
-
func NewBool(v bool) *Bool {
|
40
|
-
x := &Bool{}
|
41
|
-
if v != _zeroBool {
|
42
|
-
x.Store(v)
|
43
|
-
}
|
44
|
-
return x
|
45
|
-
}
|
46
|
-
|
47
|
-
// Load atomically loads the wrapped bool.
|
48
|
-
func (x *Bool) Load() bool {
|
49
|
-
return truthy(x.v.Load())
|
50
|
-
}
|
51
|
-
|
52
|
-
// Store atomically stores the passed bool.
|
53
|
-
func (x *Bool) Store(v bool) {
|
54
|
-
x.v.Store(boolToInt(v))
|
55
|
-
}
|
56
|
-
|
57
|
-
// CAS is an atomic compare-and-swap for bool values.
|
58
|
-
func (x *Bool) CAS(o, n bool) bool {
|
59
|
-
return x.v.CAS(boolToInt(o), boolToInt(n))
|
60
|
-
}
|
61
|
-
|
62
|
-
// Swap atomically stores the given bool and returns the old
|
63
|
-
// value.
|
64
|
-
func (x *Bool) Swap(o bool) bool {
|
65
|
-
return truthy(x.v.Swap(boolToInt(o)))
|
66
|
-
}
|
67
|
-
|
68
|
-
// MarshalJSON encodes the wrapped bool into JSON.
|
69
|
-
func (x *Bool) MarshalJSON() ([]byte, error) {
|
70
|
-
return json.Marshal(x.Load())
|
71
|
-
}
|
72
|
-
|
73
|
-
// UnmarshalJSON decodes a bool from JSON.
|
74
|
-
func (x *Bool) UnmarshalJSON(b []byte) error {
|
75
|
-
var v bool
|
76
|
-
if err := json.Unmarshal(b, &v); err != nil {
|
77
|
-
return err
|
78
|
-
}
|
79
|
-
x.Store(v)
|
80
|
-
return nil
|
81
|
-
}
|
@@ -1,53 +0,0 @@
|
|
1
|
-
// Copyright (c) 2020 Uber Technologies, Inc.
|
2
|
-
//
|
3
|
-
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
4
|
-
// of this software and associated documentation files (the "Software"), to deal
|
5
|
-
// in the Software without restriction, including without limitation the rights
|
6
|
-
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
7
|
-
// copies of the Software, and to permit persons to whom the Software is
|
8
|
-
// furnished to do so, subject to the following conditions:
|
9
|
-
//
|
10
|
-
// The above copyright notice and this permission notice shall be included in
|
11
|
-
// all copies or substantial portions of the Software.
|
12
|
-
//
|
13
|
-
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
14
|
-
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
15
|
-
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
16
|
-
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
17
|
-
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
18
|
-
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
19
|
-
// THE SOFTWARE.
|
20
|
-
|
21
|
-
package atomic
|
22
|
-
|
23
|
-
import (
|
24
|
-
"strconv"
|
25
|
-
)
|
26
|
-
|
27
|
-
//go:generate bin/gen-atomicwrapper -name=Bool -type=bool -wrapped=Uint32 -pack=boolToInt -unpack=truthy -cas -swap -json -file=bool.go
|
28
|
-
|
29
|
-
func truthy(n uint32) bool {
|
30
|
-
return n == 1
|
31
|
-
}
|
32
|
-
|
33
|
-
func boolToInt(b bool) uint32 {
|
34
|
-
if b {
|
35
|
-
return 1
|
36
|
-
}
|
37
|
-
return 0
|
38
|
-
}
|
39
|
-
|
40
|
-
// Toggle atomically negates the Boolean and returns the previous value.
|
41
|
-
func (b *Bool) Toggle() bool {
|
42
|
-
for {
|
43
|
-
old := b.Load()
|
44
|
-
if b.CAS(old, !old) {
|
45
|
-
return old
|
46
|
-
}
|
47
|
-
}
|
48
|
-
}
|
49
|
-
|
50
|
-
// String encodes the wrapped value as a string.
|
51
|
-
func (b *Bool) String() string {
|
52
|
-
return strconv.FormatBool(b.Load())
|
53
|
-
}
|
@@ -1,23 +0,0 @@
|
|
1
|
-
// Copyright (c) 2020 Uber Technologies, Inc.
|
2
|
-
//
|
3
|
-
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
4
|
-
// of this software and associated documentation files (the "Software"), to deal
|
5
|
-
// in the Software without restriction, including without limitation the rights
|
6
|
-
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
7
|
-
// copies of the Software, and to permit persons to whom the Software is
|
8
|
-
// furnished to do so, subject to the following conditions:
|
9
|
-
//
|
10
|
-
// The above copyright notice and this permission notice shall be included in
|
11
|
-
// all copies or substantial portions of the Software.
|
12
|
-
//
|
13
|
-
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
14
|
-
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
15
|
-
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
16
|
-
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
17
|
-
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
18
|
-
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
19
|
-
// THE SOFTWARE.
|
20
|
-
|
21
|
-
// Package atomic provides simple wrappers around numerics to enforce atomic
|
22
|
-
// access.
|
23
|
-
package atomic
|
@@ -1,82 +0,0 @@
|
|
1
|
-
// @generated Code generated by gen-atomicwrapper.
|
2
|
-
|
3
|
-
// Copyright (c) 2020 Uber Technologies, Inc.
|
4
|
-
//
|
5
|
-
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
-
// of this software and associated documentation files (the "Software"), to deal
|
7
|
-
// in the Software without restriction, including without limitation the rights
|
8
|
-
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
-
// copies of the Software, and to permit persons to whom the Software is
|
10
|
-
// furnished to do so, subject to the following conditions:
|
11
|
-
//
|
12
|
-
// The above copyright notice and this permission notice shall be included in
|
13
|
-
// all copies or substantial portions of the Software.
|
14
|
-
//
|
15
|
-
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
-
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
-
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
-
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
-
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
-
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
21
|
-
// THE SOFTWARE.
|
22
|
-
|
23
|
-
package atomic
|
24
|
-
|
25
|
-
import (
|
26
|
-
"encoding/json"
|
27
|
-
"time"
|
28
|
-
)
|
29
|
-
|
30
|
-
// Duration is an atomic type-safe wrapper for time.Duration values.
|
31
|
-
type Duration struct {
|
32
|
-
_ nocmp // disallow non-atomic comparison
|
33
|
-
|
34
|
-
v Int64
|
35
|
-
}
|
36
|
-
|
37
|
-
var _zeroDuration time.Duration
|
38
|
-
|
39
|
-
// NewDuration creates a new Duration.
|
40
|
-
func NewDuration(v time.Duration) *Duration {
|
41
|
-
x := &Duration{}
|
42
|
-
if v != _zeroDuration {
|
43
|
-
x.Store(v)
|
44
|
-
}
|
45
|
-
return x
|
46
|
-
}
|
47
|
-
|
48
|
-
// Load atomically loads the wrapped time.Duration.
|
49
|
-
func (x *Duration) Load() time.Duration {
|
50
|
-
return time.Duration(x.v.Load())
|
51
|
-
}
|
52
|
-
|
53
|
-
// Store atomically stores the passed time.Duration.
|
54
|
-
func (x *Duration) Store(v time.Duration) {
|
55
|
-
x.v.Store(int64(v))
|
56
|
-
}
|
57
|
-
|
58
|
-
// CAS is an atomic compare-and-swap for time.Duration values.
|
59
|
-
func (x *Duration) CAS(o, n time.Duration) bool {
|
60
|
-
return x.v.CAS(int64(o), int64(n))
|
61
|
-
}
|
62
|
-
|
63
|
-
// Swap atomically stores the given time.Duration and returns the old
|
64
|
-
// value.
|
65
|
-
func (x *Duration) Swap(o time.Duration) time.Duration {
|
66
|
-
return time.Duration(x.v.Swap(int64(o)))
|
67
|
-
}
|
68
|
-
|
69
|
-
// MarshalJSON encodes the wrapped time.Duration into JSON.
|
70
|
-
func (x *Duration) MarshalJSON() ([]byte, error) {
|
71
|
-
return json.Marshal(x.Load())
|
72
|
-
}
|
73
|
-
|
74
|
-
// UnmarshalJSON decodes a time.Duration from JSON.
|
75
|
-
func (x *Duration) UnmarshalJSON(b []byte) error {
|
76
|
-
var v time.Duration
|
77
|
-
if err := json.Unmarshal(b, &v); err != nil {
|
78
|
-
return err
|
79
|
-
}
|
80
|
-
x.Store(v)
|
81
|
-
return nil
|
82
|
-
}
|
@@ -1,40 +0,0 @@
|
|
1
|
-
// Copyright (c) 2020 Uber Technologies, Inc.
|
2
|
-
//
|
3
|
-
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
4
|
-
// of this software and associated documentation files (the "Software"), to deal
|
5
|
-
// in the Software without restriction, including without limitation the rights
|
6
|
-
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
7
|
-
// copies of the Software, and to permit persons to whom the Software is
|
8
|
-
// furnished to do so, subject to the following conditions:
|
9
|
-
//
|
10
|
-
// The above copyright notice and this permission notice shall be included in
|
11
|
-
// all copies or substantial portions of the Software.
|
12
|
-
//
|
13
|
-
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
14
|
-
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
15
|
-
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
16
|
-
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
17
|
-
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
18
|
-
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
19
|
-
// THE SOFTWARE.
|
20
|
-
|
21
|
-
package atomic
|
22
|
-
|
23
|
-
import "time"
|
24
|
-
|
25
|
-
//go:generate bin/gen-atomicwrapper -name=Duration -type=time.Duration -wrapped=Int64 -pack=int64 -unpack=time.Duration -cas -swap -json -imports time -file=duration.go
|
26
|
-
|
27
|
-
// Add atomically adds to the wrapped time.Duration and returns the new value.
|
28
|
-
func (d *Duration) Add(n time.Duration) time.Duration {
|
29
|
-
return time.Duration(d.v.Add(int64(n)))
|
30
|
-
}
|
31
|
-
|
32
|
-
// Sub atomically subtracts from the wrapped time.Duration and returns the new value.
|
33
|
-
func (d *Duration) Sub(n time.Duration) time.Duration {
|
34
|
-
return time.Duration(d.v.Sub(int64(n)))
|
35
|
-
}
|
36
|
-
|
37
|
-
// String encodes the wrapped value as a string.
|
38
|
-
func (d *Duration) String() string {
|
39
|
-
return d.Load().String()
|
40
|
-
}
|
@@ -1,51 +0,0 @@
|
|
1
|
-
// @generated Code generated by gen-atomicwrapper.
|
2
|
-
|
3
|
-
// Copyright (c) 2020 Uber Technologies, Inc.
|
4
|
-
//
|
5
|
-
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
-
// of this software and associated documentation files (the "Software"), to deal
|
7
|
-
// in the Software without restriction, including without limitation the rights
|
8
|
-
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
-
// copies of the Software, and to permit persons to whom the Software is
|
10
|
-
// furnished to do so, subject to the following conditions:
|
11
|
-
//
|
12
|
-
// The above copyright notice and this permission notice shall be included in
|
13
|
-
// all copies or substantial portions of the Software.
|
14
|
-
//
|
15
|
-
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
-
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
-
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
-
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
-
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
-
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
21
|
-
// THE SOFTWARE.
|
22
|
-
|
23
|
-
package atomic
|
24
|
-
|
25
|
-
// Error is an atomic type-safe wrapper for error values.
|
26
|
-
type Error struct {
|
27
|
-
_ nocmp // disallow non-atomic comparison
|
28
|
-
|
29
|
-
v Value
|
30
|
-
}
|
31
|
-
|
32
|
-
var _zeroError error
|
33
|
-
|
34
|
-
// NewError creates a new Error.
|
35
|
-
func NewError(v error) *Error {
|
36
|
-
x := &Error{}
|
37
|
-
if v != _zeroError {
|
38
|
-
x.Store(v)
|
39
|
-
}
|
40
|
-
return x
|
41
|
-
}
|
42
|
-
|
43
|
-
// Load atomically loads the wrapped error.
|
44
|
-
func (x *Error) Load() error {
|
45
|
-
return unpackError(x.v.Load())
|
46
|
-
}
|
47
|
-
|
48
|
-
// Store atomically stores the passed error.
|
49
|
-
func (x *Error) Store(v error) {
|
50
|
-
x.v.Store(packError(v))
|
51
|
-
}
|
@@ -1,39 +0,0 @@
|
|
1
|
-
// Copyright (c) 2020 Uber Technologies, Inc.
|
2
|
-
//
|
3
|
-
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
4
|
-
// of this software and associated documentation files (the "Software"), to deal
|
5
|
-
// in the Software without restriction, including without limitation the rights
|
6
|
-
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
7
|
-
// copies of the Software, and to permit persons to whom the Software is
|
8
|
-
// furnished to do so, subject to the following conditions:
|
9
|
-
//
|
10
|
-
// The above copyright notice and this permission notice shall be included in
|
11
|
-
// all copies or substantial portions of the Software.
|
12
|
-
//
|
13
|
-
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
14
|
-
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
15
|
-
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
16
|
-
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
17
|
-
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
18
|
-
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
19
|
-
// THE SOFTWARE.
|
20
|
-
|
21
|
-
package atomic
|
22
|
-
|
23
|
-
// atomic.Value panics on nil inputs, or if the underlying type changes.
|
24
|
-
// Stabilize by always storing a custom struct that we control.
|
25
|
-
|
26
|
-
//go:generate bin/gen-atomicwrapper -name=Error -type=error -wrapped=Value -pack=packError -unpack=unpackError -file=error.go
|
27
|
-
|
28
|
-
type packedError struct{ Value error }
|
29
|
-
|
30
|
-
func packError(v error) interface{} {
|
31
|
-
return packedError{v}
|
32
|
-
}
|
33
|
-
|
34
|
-
func unpackError(v interface{}) error {
|
35
|
-
if err, ok := v.(packedError); ok {
|
36
|
-
return err.Value
|
37
|
-
}
|
38
|
-
return nil
|
39
|
-
}
|
@@ -1,76 +0,0 @@
|
|
1
|
-
// @generated Code generated by gen-atomicwrapper.
|
2
|
-
|
3
|
-
// Copyright (c) 2020 Uber Technologies, Inc.
|
4
|
-
//
|
5
|
-
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
-
// of this software and associated documentation files (the "Software"), to deal
|
7
|
-
// in the Software without restriction, including without limitation the rights
|
8
|
-
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
-
// copies of the Software, and to permit persons to whom the Software is
|
10
|
-
// furnished to do so, subject to the following conditions:
|
11
|
-
//
|
12
|
-
// The above copyright notice and this permission notice shall be included in
|
13
|
-
// all copies or substantial portions of the Software.
|
14
|
-
//
|
15
|
-
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
-
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
-
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
-
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
-
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
-
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
21
|
-
// THE SOFTWARE.
|
22
|
-
|
23
|
-
package atomic
|
24
|
-
|
25
|
-
import (
|
26
|
-
"encoding/json"
|
27
|
-
"math"
|
28
|
-
)
|
29
|
-
|
30
|
-
// Float64 is an atomic type-safe wrapper for float64 values.
|
31
|
-
type Float64 struct {
|
32
|
-
_ nocmp // disallow non-atomic comparison
|
33
|
-
|
34
|
-
v Uint64
|
35
|
-
}
|
36
|
-
|
37
|
-
var _zeroFloat64 float64
|
38
|
-
|
39
|
-
// NewFloat64 creates a new Float64.
|
40
|
-
func NewFloat64(v float64) *Float64 {
|
41
|
-
x := &Float64{}
|
42
|
-
if v != _zeroFloat64 {
|
43
|
-
x.Store(v)
|
44
|
-
}
|
45
|
-
return x
|
46
|
-
}
|
47
|
-
|
48
|
-
// Load atomically loads the wrapped float64.
|
49
|
-
func (x *Float64) Load() float64 {
|
50
|
-
return math.Float64frombits(x.v.Load())
|
51
|
-
}
|
52
|
-
|
53
|
-
// Store atomically stores the passed float64.
|
54
|
-
func (x *Float64) Store(v float64) {
|
55
|
-
x.v.Store(math.Float64bits(v))
|
56
|
-
}
|
57
|
-
|
58
|
-
// CAS is an atomic compare-and-swap for float64 values.
|
59
|
-
func (x *Float64) CAS(o, n float64) bool {
|
60
|
-
return x.v.CAS(math.Float64bits(o), math.Float64bits(n))
|
61
|
-
}
|
62
|
-
|
63
|
-
// MarshalJSON encodes the wrapped float64 into JSON.
|
64
|
-
func (x *Float64) MarshalJSON() ([]byte, error) {
|
65
|
-
return json.Marshal(x.Load())
|
66
|
-
}
|
67
|
-
|
68
|
-
// UnmarshalJSON decodes a float64 from JSON.
|
69
|
-
func (x *Float64) UnmarshalJSON(b []byte) error {
|
70
|
-
var v float64
|
71
|
-
if err := json.Unmarshal(b, &v); err != nil {
|
72
|
-
return err
|
73
|
-
}
|
74
|
-
x.Store(v)
|
75
|
-
return nil
|
76
|
-
}
|
@@ -1,47 +0,0 @@
|
|
1
|
-
// Copyright (c) 2020 Uber Technologies, Inc.
|
2
|
-
//
|
3
|
-
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
4
|
-
// of this software and associated documentation files (the "Software"), to deal
|
5
|
-
// in the Software without restriction, including without limitation the rights
|
6
|
-
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
7
|
-
// copies of the Software, and to permit persons to whom the Software is
|
8
|
-
// furnished to do so, subject to the following conditions:
|
9
|
-
//
|
10
|
-
// The above copyright notice and this permission notice shall be included in
|
11
|
-
// all copies or substantial portions of the Software.
|
12
|
-
//
|
13
|
-
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
14
|
-
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
15
|
-
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
16
|
-
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
17
|
-
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
18
|
-
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
19
|
-
// THE SOFTWARE.
|
20
|
-
|
21
|
-
package atomic
|
22
|
-
|
23
|
-
import "strconv"
|
24
|
-
|
25
|
-
//go:generate bin/gen-atomicwrapper -name=Float64 -type=float64 -wrapped=Uint64 -pack=math.Float64bits -unpack=math.Float64frombits -cas -json -imports math -file=float64.go
|
26
|
-
|
27
|
-
// Add atomically adds to the wrapped float64 and returns the new value.
|
28
|
-
func (f *Float64) Add(s float64) float64 {
|
29
|
-
for {
|
30
|
-
old := f.Load()
|
31
|
-
new := old + s
|
32
|
-
if f.CAS(old, new) {
|
33
|
-
return new
|
34
|
-
}
|
35
|
-
}
|
36
|
-
}
|
37
|
-
|
38
|
-
// Sub atomically subtracts from the wrapped float64 and returns the new value.
|
39
|
-
func (f *Float64) Sub(s float64) float64 {
|
40
|
-
return f.Add(-s)
|
41
|
-
}
|
42
|
-
|
43
|
-
// String encodes the wrapped value as a string.
|
44
|
-
func (f *Float64) String() string {
|
45
|
-
// 'g' is the behavior for floats with %v.
|
46
|
-
return strconv.FormatFloat(f.Load(), 'g', -1, 64)
|
47
|
-
}
|
@@ -1,26 +0,0 @@
|
|
1
|
-
// Copyright (c) 2020 Uber Technologies, Inc.
|
2
|
-
//
|
3
|
-
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
4
|
-
// of this software and associated documentation files (the "Software"), to deal
|
5
|
-
// in the Software without restriction, including without limitation the rights
|
6
|
-
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
7
|
-
// copies of the Software, and to permit persons to whom the Software is
|
8
|
-
// furnished to do so, subject to the following conditions:
|
9
|
-
//
|
10
|
-
// The above copyright notice and this permission notice shall be included in
|
11
|
-
// all copies or substantial portions of the Software.
|
12
|
-
//
|
13
|
-
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
14
|
-
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
15
|
-
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
16
|
-
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
17
|
-
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
18
|
-
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
19
|
-
// THE SOFTWARE.
|
20
|
-
|
21
|
-
package atomic
|
22
|
-
|
23
|
-
//go:generate bin/gen-atomicint -name=Int32 -wrapped=int32 -file=int32.go
|
24
|
-
//go:generate bin/gen-atomicint -name=Int64 -wrapped=int64 -file=int64.go
|
25
|
-
//go:generate bin/gen-atomicint -name=Uint32 -wrapped=uint32 -unsigned -file=uint32.go
|
26
|
-
//go:generate bin/gen-atomicint -name=Uint64 -wrapped=uint64 -unsigned -file=uint64.go
|