refactor: prepare ArchiveService for LogosStorage extension#7312
Conversation
Jenkins BuildsClick to see older builds (225)
|
Codecov Report❌ Patch coverage is ❌ Your patch status has failed because the patch coverage (44.37%) is below the target coverage (50.00%). You can increase the patch coverage or adjust the target coverage. Additional details and impacted files@@ Coverage Diff @@
## develop #7312 +/- ##
===========================================
- Coverage 61.23% 61.08% -0.15%
===========================================
Files 832 836 +4
Lines 116660 117158 +498
===========================================
+ Hits 71431 71562 +131
- Misses 37862 38214 +352
- Partials 7367 7382 +15
Flags with carried forward coverage won't be shown. Click here to find out more.
|
6f8008f to
d085990
Compare
d085990 to
1144c71
Compare
1144c71 to
eb1981b
Compare
9188470 to
d9c5e4c
Compare
igor-sirotin
left a comment
There was a problem hiding this comment.
Looks good, much cleaner now, thank you!
|
I think 44% patch is ok for this refactor |
44b799d to
b187d1e
Compare
|
9e57c28 to
dee7073
Compare
| // CommunityExists checks if a community with the given ID exists in the database. | ||
| // This is a lightweight alternative to GetByID when only existence checking is needed. | ||
| func (p *Persistence) CommunityExists(memberIdentity *ecdsa.PublicKey, id []byte) (bool, error) { | ||
| r, err := p.getByID(id, memberIdentity) |
There was a problem hiding this comment.
For a truly lightweight version, we could do a SELECT COUNT(1) FROM communities WHERE ID=id
634657a to
673e345
Compare
ff12faa to
5d1f1c4
Compare
|
I rebased this branch and also created the companion PR: status-im/status-app#20208 |
9ef169f to
8aaa3dd
Compare
f354a68 to
f65df05
Compare
…ally slightly easier
f65df05 to
2a97883
Compare
2a97883 to
3bf31bb
Compare
status-app PR: status-im/status-app#20208
This PR brings new
ArchiveServicearchitecture. The new ArchiveService interface includes (by composition) theArchiveServiceBackendinterface (defined in the same file), which defines operations specific to the given archive storage technology (e.g. BitTorrent or LogosStorage).ArchiveServicealso defines its own technology independent operations.ArchiveServiceis implemented by ArchiveManager. On the construction using the factory function NewArchiveManager it instantiates either:Which concrete backend implementation will be instantiated depends on the content of the
amc *archivetypes.ArchiveManagerConfigargument to theNewArchiveManagerfactory function. If no appropriate configuration is found or none isEnabled, the factory returns a NOP implementation. This allows us to simplify the code in various places by removing a number of defensive checks. The NOP implementation will also be used whendisable_history_archivesbuild flag is defined (replaces previousdisable_torrentflag serving the same purpose).The lifecycle is also simplified. There is one intended way of instantiating
ArchiveManager(the above mentionedNewArchiveManagerfactory function) and theArchiveServiceinterface communicates clearly the intended public API hiding the backend and other implementation details. Still, to support the legacy tests (relevant test improvements may be considered in the future, but kept our of scope of this PR), bothArchiveManagerand the relevant backend implementations can provide additional methods accessible by bypassing theArchiveServiceinterface.All relevant sources are distributed across a number of packages under
protocol/communities/archiveto make decoupling from theprotocol/communitiespackage possible.For large majority of the code, the original functionality is preserved, with subtle interface adjustments to accommodate incoming
LogosStorageextension (which basically means providing a new backend implementation and archive technology-specific sources).