* Adds Mutex Map
Signed-off-by: Elena Kolevska <elena@kolevska.com>
* Adds an atomic map
Signed-off-by: Elena Kolevska <elena@kolevska.com>
* More work on atomic map and mutex map
Signed-off-by: Elena Kolevska <elena@kolevska.com>
* Fixes, improvements and more tests
Signed-off-by: Elena Kolevska <elena@kolevska.com>
* Updates interface
Signed-off-by: Elena Kolevska <elena@kolevska.com>
* Linter
Signed-off-by: Elena Kolevska <elena@kolevska.com>
* Refactors atomic map to use generics
Signed-off-by: Elena Kolevska <elena@kolevska.com>
* cleanups
Signed-off-by: Elena Kolevska <elena@kolevska.com>
* Apply suggestions from code review
Co-authored-by: Cassie Coyle <cassie.i.coyle@gmail.com>
Signed-off-by: Elena Kolevska <elena-kolevska@users.noreply.github.com>
* small reorg
Signed-off-by: Elena Kolevska <elena@kolevska.com>
* Adds ItemCount()
Signed-off-by: Elena Kolevska <elena@kolevska.com>
* Removes atomicmap in favour of haxmap
Signed-off-by: Elena Kolevska <elena@kolevska.com>
* formats fix and adds comment
Signed-off-by: Elena Kolevska <elena@kolevska.com>
* Update concurrency/mutexmap.go
Co-authored-by: Josh van Leeuwen <me@joshvanl.dev>
Signed-off-by: Elena Kolevska <elena-kolevska@users.noreply.github.com>
* Uses built in `clear`
Signed-off-by: Elena Kolevska <elena@kolevska.com>
* Revert "Removes atomicmap in favour of haxmap"
This reverts commit 20ca9ad197.
Signed-off-by: Elena Kolevska <elena@kolevska.com>
* Uses clear() for atomic map too
Signed-off-by: Elena Kolevska <elena@kolevska.com>
---------
Signed-off-by: Elena Kolevska <elena@kolevska.com>
Signed-off-by: Elena Kolevska <elena-kolevska@users.noreply.github.com>
Co-authored-by: Cassie Coyle <cassie.i.coyle@gmail.com>
Co-authored-by: Josh van Leeuwen <me@joshvanl.dev>
* Adds crypto/spiffe
Adds spiffe package to crypto. This is a refactored version of the
existing `pkg/security` package. This new package is more modulated and
fuller test coverage.
This package has been moved so that it can be both imported by dapr &
components-contrib, as well as making the package more suitable for
further development to support X.509 Component auth.
https://github.com/dapr/proposals/pull/51
Also moves in `test/utils` from dapr to `crypto/test` for shared usage.
Signed-off-by: joshvanl <me@joshvanl.dev>
* Adds crypto/spiffe/context
Signed-off-by: joshvanl <me@joshvanl.dev>
---------
Signed-off-by: joshvanl <me@joshvanl.dev>
* Events: type Batcher value & ensure queue order
Update Batcher to allow for typed value types.
Update Batcher and Queue to execute values in order they were added.
Signed-off-by: joshvanl <me@joshvanl.dev>
* Delay batcher to ensure key is sent in order
Signed-off-by: joshvanl <me@joshvanl.dev>
---------
Signed-off-by: joshvanl <me@joshvanl.dev>
* events/batcher: use events/queue as queue backend
Signed-off-by: joshvanl <me@joshvanl.dev>
* Make events/queue/queue key type comparable
Signed-off-by: joshvanl <me@joshvanl.dev>
* Explicitly define NewProcessor generic type in test
Signed-off-by: joshvanl <me@joshvanl.dev>
---------
Signed-off-by: joshvanl <me@joshvanl.dev>
This is helpful when the JWKS is located on a HTTPS endpoint and the certificate is signed by a custom CA.
Signed-off-by: ItalyPaleAle <43508+ItalyPaleAle@users.noreply.github.com>
* Add `ttlcache` package
This implements an in-memory cache with a TTL for automatically expiring records
Signed-off-by: ItalyPaleAle <43508+ItalyPaleAle@users.noreply.github.com>
* Add delete method
Signed-off-by: ItalyPaleAle <43508+ItalyPaleAle@users.noreply.github.com>
---------
Signed-off-by: ItalyPaleAle <43508+ItalyPaleAle@users.noreply.github.com>
* Move dapr/concurrency to kit (#72)
* Move dapr/concurrency to kit
Does not include any code change
Signed-off-by: ItalyPaleAle <43508+ItalyPaleAle@users.noreply.github.com>
* Fixed copyright year
Signed-off-by: ItalyPaleAle <43508+ItalyPaleAle@users.noreply.github.com>
* Improved memory usage in error collection
Signed-off-by: ItalyPaleAle <43508+ItalyPaleAle@users.noreply.github.com>
---------
Signed-off-by: ItalyPaleAle <43508+ItalyPaleAle@users.noreply.github.com>
Signed-off-by: Cassandra Coyle <cassie@diagrid.io>
* Move `pkg/signals` from dapr/dapr to kit (#70)
No code changes
Signed-off-by: ItalyPaleAle <43508+ItalyPaleAle@users.noreply.github.com>
Signed-off-by: Cassandra Coyle <cassie@diagrid.io>
* Move dapr/utils/streams to kit (#68)
* Move dapr/utils/streams to kit
No code changes
Signed-off-by: ItalyPaleAle <43508+ItalyPaleAle@users.noreply.github.com>
* 💄
Signed-off-by: ItalyPaleAle <43508+ItalyPaleAle@users.noreply.github.com>
* Lint
Signed-off-by: ItalyPaleAle <43508+ItalyPaleAle@users.noreply.github.com>
---------
Signed-off-by: ItalyPaleAle <43508+ItalyPaleAle@users.noreply.github.com>
Signed-off-by: Cassandra Coyle <cassie@diagrid.io>
* Migrate metadata decoder from components-contrib to kit (#74)
* Migrate metadata decoder from components-contrib to kit
Required creating the `utils` package for utils.IsTruthy too (ported from runtime)
Signed-off-by: ItalyPaleAle <43508+ItalyPaleAle@users.noreply.github.com>
* Lint
Signed-off-by: ItalyPaleAle <43508+ItalyPaleAle@users.noreply.github.com>
---------
Signed-off-by: ItalyPaleAle <43508+ItalyPaleAle@users.noreply.github.com>
Signed-off-by: Cassandra Coyle <cassie@diagrid.io>
* initial standardized err pkg: errfmt
Signed-off-by: Cassandra Coyle <cassie@diagrid.io>
* tweaks to error pkg and update tests. need to confirm reason
Signed-off-by: Cassandra Coyle <cassie@diagrid.io>
* cleanup test
Signed-off-by: Cassandra Coyle <cassie@diagrid.io>
* add new func for err. change to protojson for http. need to figure out grpc status tho
Signed-off-by: Cassandra Coyle <cassie@diagrid.io>
* update status name
Signed-off-by: Cassandra Coyle <cassie@diagrid.io>
* wip: update JSONErrorValue
Signed-off-by: Cassandra Coyle <cassie@diagrid.io>
* Updates err to json conversion. Organises error messages and codes
Signed-off-by: Elena Kolevska <elena@kolevska.com>
Signed-off-by: Cassandra Coyle <cassie@diagrid.io>
* add type to http json output. tests are a WIP
Signed-off-by: Cassandra Coyle <cassie@diagrid.io>
* add all details, update tests, prefixes/postfixes
Signed-off-by: Cassandra Coyle <cassie@diagrid.io>
* add README
Signed-off-by: Cassandra Coyle <cassie@diagrid.io>
* use strongly-typed struct for errJSON
Signed-off-by: Cassandra Coyle <cassie@diagrid.io>
* update README
Signed-off-by: Cassandra Coyle <cassie@diagrid.io>
* Adds the option to add a help link detail and a field violation detail
Signed-off-by: Elena Kolevska <elena@kolevska.com>
Signed-off-by: Cassandra Coyle <cassie@diagrid.io>
* Update fswatcher to use /events/batcher (#75)
* Update fswatcher to use /events/batcher
Signed-off-by: joshvanl <me@joshvanl.dev>
* Linting
Signed-off-by: joshvanl <me@joshvanl.dev>
* Linting
Signed-off-by: joshvanl <me@joshvanl.dev>
* Add sleep to wait for windows fsnotify to become ready
Signed-off-by: joshvanl <me@joshvanl.dev>
* Increase time for event to be received to 1 second
Signed-off-by: joshvanl <me@joshvanl.dev>
---------
Signed-off-by: joshvanl <me@joshvanl.dev>
Signed-off-by: Cassandra Coyle <cassie@diagrid.io>
* Adds tests for WithHelp and err.WithFieldViolation
Signed-off-by: Elena Kolevska <elena@kolevska.com>
Signed-off-by: Cassandra Coyle <cassie@diagrid.io>
* rebase and update proto field access to rebased code
Signed-off-by: Cassandra Coyle <cassie@diagrid.io>
* gofumpt
Signed-off-by: Cassandra Coyle <cassie@diagrid.io>
* errJson -> errJSON and update proto field access
Signed-off-by: Cassandra Coyle <cassie@diagrid.io>
* HttpCode -> HTTPCode per CI warnings
Signed-off-by: Cassandra Coyle <cassie@diagrid.io>
* rm reason since its not used
Signed-off-by: Cassandra Coyle <cassie@diagrid.io>
* update return type in README example
Signed-off-by: Cassandra Coyle <cassie@diagrid.io>
* use builder, add errorInfo check to Build(), update and add tests for new funcs, add getters for grpc/http codes
Signed-off-by: Cassandra Coyle <cassie@diagrid.io>
* appease CI
Signed-off-by: Cassandra Coyle <cassie@diagrid.io>
* update README
Signed-off-by: Cassandra Coyle <cassie@diagrid.io>
* make GRPCStatus val receiver
Signed-off-by: Cassandra Coyle <cassie@diagrid.io>
* Update messages.go
Signed-off-by: Artur Souza <asouza.pro@gmail.com>
* add test to ensure we have a switch for all google err_detail types
Signed-off-by: Cassandra Coyle <cassie@diagrid.io>
* rebase and update log
Signed-off-by: Cassandra Coyle <cassie@diagrid.io>
* re-export ErrorBuilder
Signed-off-by: Cassandra Coyle <cassie@diagrid.io>
* Update errors/errors.go
Co-authored-by: Alessandro (Ale) Segala <43508+ItalyPaleAle@users.noreply.github.com>
Signed-off-by: Cassie Coyle <cassie.i.coyle@gmail.com>
* use ast pkg to dynamically grab our errTypes in the switch case instead of hard coding it
Signed-off-by: Cassandra Coyle <cassie@diagrid.io>
* appease CI
Signed-off-by: Cassandra Coyle <cassie@diagrid.io>
* add FromError func
Signed-off-by: Cassandra Coyle <cassie@diagrid.io>
* account for error wrapping
Signed-off-by: Cassandra Coyle <cassie@diagrid.io>
---------
Signed-off-by: Alessandro (Ale) Segala <43508+ItalyPaleAle@users.noreply.github.com>
Signed-off-by: Cassandra Coyle <cassie@diagrid.io>
Signed-off-by: Elena Kolevska <elena@kolevska.com>
Signed-off-by: joshvanl <me@joshvanl.dev>
Signed-off-by: Cassie Coyle <cassie.i.coyle@gmail.com>
Co-authored-by: Alessandro (Ale) Segala <43508+ItalyPaleAle@users.noreply.github.com>
Co-authored-by: Elena Kolevska <elena@kolevska.com>
Co-authored-by: Josh van Leeuwen <me@joshvanl.dev>
* Update fswatcher to use /events/batcher
Signed-off-by: joshvanl <me@joshvanl.dev>
* Linting
Signed-off-by: joshvanl <me@joshvanl.dev>
* Linting
Signed-off-by: joshvanl <me@joshvanl.dev>
* Add sleep to wait for windows fsnotify to become ready
Signed-off-by: joshvanl <me@joshvanl.dev>
* Increase time for event to be received to 1 second
Signed-off-by: joshvanl <me@joshvanl.dev>
---------
Signed-off-by: joshvanl <me@joshvanl.dev>
* Move dapr/concurrency to kit
Does not include any code change
Signed-off-by: ItalyPaleAle <43508+ItalyPaleAle@users.noreply.github.com>
* Fixed copyright year
Signed-off-by: ItalyPaleAle <43508+ItalyPaleAle@users.noreply.github.com>
* Improved memory usage in error collection
Signed-off-by: ItalyPaleAle <43508+ItalyPaleAle@users.noreply.github.com>
---------
Signed-off-by: ItalyPaleAle <43508+ItalyPaleAle@users.noreply.github.com>
* Adds events/ratelimiting/coalecing
events/ratelimiting is a new utility package to provides helpers which
can be used to rate limit events.
Coalecing is a new helper that will exponentially rate limit events. It
will coalesce events into a single event if they occur within the same
rate limiting window. Coalesce also has the option to forcibly fire an
event when the number of events reaches a certain threshold. Added to
prevent events from never being fired in a high throughput scenario.
Signed-off-by: joshvanl <me@joshvanl.dev>
Signed-off-by: Josh van Leeuwen <me@joshvanl.dev>
Signed-off-by: Alessandro (Ale) Segala <43508+ItalyPaleAle@users.noreply.github.com>
Co-authored-by: Alessandro (Ale) Segala <43508+ItalyPaleAle@users.noreply.github.com>
PR updates the cron tests to use a mocked clock instead of the wall
in order to speed up the tests from ~40s to ~1.5s. This also has the
benefit of controlling time so that tests are more deterministic.
Signed-off-by: joshvanl <me@joshvanl.dev>
* Fixing running tests on aarch64 arm machines
Signed-off-by: joshvanl <me@joshvanl.dev>
* Use different Makefile target for doing go test with race enabled
Signed-off-by: joshvanl <me@joshvanl.dev>
---------
Signed-off-by: joshvanl <me@joshvanl.dev>
There are use cases where having those methods available even outside of a unit test is helpful, such as when the objects are instantiated with a clock that could be mocked in the unit test for the parent method.
Signed-off-by: ItalyPaleAle <43508+ItalyPaleAle@users.noreply.github.com>
This makes it so there are no 3 additional goroutines (even if idle) created when the library is imported.
See: lestrrat-go/jwx#929
Signed-off-by: ItalyPaleAle <43508+ItalyPaleAle@users.noreply.github.com>
Updates github.com/lestrrat-go/jwx/v2 and golang.org/x/crypto, which also includes security fixes
Signed-off-by: ItalyPaleAle <43508+ItalyPaleAle@users.noreply.github.com>
1. Removed `github.com/pkg/errors` and replaced with the standard library (linter now rejects the old package)
2. Cron test: fixed race conditions and linting
3. Renamed `logger/default.go` to `logger/nop_logger.go` to match the name of the struct inside
Signed-off-by: ItalyPaleAle <43508+ItalyPaleAle@users.noreply.github.com>
Signed-off-by: ItalyPaleAle <43508+ItalyPaleAle@users.noreply.github.com>