Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adds a "local" storage driver that handles all operations in memory #112

Open
wants to merge 15 commits into
base: main
Choose a base branch
from

Conversation

lonelycode
Copy link
Member

Description

This PR adds a "local" storage handler type, this uses an in-memory non-blocking hashmap to store data, the implementation is entirely in Go, and the local handler API object is designed to take any KV store as a back-end but will perform all advanced operations (such as sets and sorted sets) in go instead of using native capabilities. This is so we can experiment with multiple k/v stores without having to write a whole new interface implementation from scratch (e.g. some k/v stores may not have delete or flush capabilities).

Related Issue

https://tyktech.atlassian.net/browse/TT-748

Motivation and Context

Having a "stateless" version of Tyk makes testing easier for end users and our team. It also means that new users can"kick the tyres" quickly without needing to set up Redis and therefore get time-to-value down.

Test Coverage For This Change

Changes were tested with the existing testutil package, extended for all temporal components including a queue mock, also added one additional test to ensure that the Increment() feature actually incremented.

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Refactoring or add test (improvements in base code or adds test coverage to functionality)
  • Documentation updates or improvements.

Checklist

  • I have reviewed the guidelines for contributing to this repository.
  • Make sure you are requesting to pull a topic/feature/bugfix branch (right side). If PRing from your fork, don't come from your master!
  • Make sure you are making a pull request against our master branch (left side). Also, it would be best if you started your change off our latest master.
  • My change requires a change to the documentation.
    • I have manually updated the README(s)/documentation accordingly.
    • If you've changed APIs, describe what needs to be updated in the documentation.
  • I have updated the documentation accordingly.
  • Modules and vendor dependencies have been updated; run go mod tidy && go mod vendor
  • When updating library version must provide reason/explanation for this update.
  • I have added tests to cover my changes.
  • All new and existing tests passed.
  • Check your code additions will not fail linting checks:
    • gofmt -s -w .
    • go vet ./...

@lonelycode lonelycode added the enhancement New feature or request label Aug 12, 2024
@lonelycode lonelycode requested a review from buger August 12, 2024 02:21
@lonelycode lonelycode changed the title Adds a "local" storage driver that handles all oeprations in memory Adds a "local" storage driver that handles all operations in memory Aug 12, 2024
Copy link

github-actions bot commented Aug 12, 2024

CLA Assistant Lite bot All contributors have signed the CLA ✍️ ✅

@lonelycode
Copy link
Member Author

I have read the CLA Document and I hereby sign the CLA

Copy link

Quality Gate Failed Quality Gate failed

Failed conditions
C Reliability Rating on New Code (required ≥ A)

See analysis details on SonarCloud

Catch issues before they fail your Quality Gate with our IDE extension SonarLint

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant