Adds an internal package, which defines Route structures, as well as the interface for a RouteIterator
Adds the backend package, and defines the interface for implementing a storage backend
Many of the methods now require taking in a context.Context to implement timeouts, as well as preparing for future backends that require API calls to outside services
Moves the leveldb implementation into the backend package as a subpackage
Updates unit tests to use the leveldb backend.
I also tested this by installing the current version of go and running it over a pre-existing leveldb that was made with this encapsulation, and confirmed that functionality looked good. It seems to work both forwards and backwards
It's kinda large. I can probably split it by moving to the vendor module in a separate PR, and also by adding passing of context.Context separately as well. Let me know if you'd like it split up.
This PR:
internal
package, which definesRoute
structures, as well as the interface for aRouteIterator
backend
package, and defines the interface for implementing a storage backendcontext.Context
to implement timeouts, as well as preparing for future backends that require API calls to outside servicesbackend
package as a subpackageI also tested this by installing the current version of
go
and running it over a pre-existing leveldb that was made with this encapsulation, and confirmed that functionality looked good. It seems to work both forwards and backwardsIt's kinda large. I can probably split it by moving to the vendor module in a separate PR, and also by adding passing of
context.Context
separately as well. Let me know if you'd like it split up.