Skip to content

Commit

Permalink
Introduce community history archive routine
Browse files Browse the repository at this point in the history
This introduces logic needed to:

- Create WakuMessageArchives and and indices from store waku messages
- History archive torrent data to disk and create .torrent file from
  that
- Seed and unseed history archive torrents as necessary
- Starting/stopping the torrent client
- Enabling/disabling community history support for individual components
  and starting/stopping the routine intervals accordingly

This does not yet handle magnet links (#2568)

Closes #2567
  • Loading branch information
0x-r4bbit committed Mar 21, 2022
1 parent c6215b8 commit 3e1eb0a
Show file tree
Hide file tree
Showing 16 changed files with 2,031 additions and 149 deletions.
46 changes: 35 additions & 11 deletions appdatabase/migrations/bindata.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
CREATE TABLE communities_archive_info (
community_id TEXT PRIMARY KEY ON CONFLICT REPLACE,
magnetlink_clock INT NOT NULL DEFAULT 0,
last_message_archive_end_date INT NOT NULL DEFAULT 0
)


17 changes: 17 additions & 0 deletions eth-node/types/topic.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
package types

import (
"github.com/ethereum/go-ethereum/common/hexutil"
)

const (
// TopicLength is the expected length of the topic, in bytes
TopicLength = 4
Expand Down Expand Up @@ -84,3 +88,16 @@ func MakeFullNodeBloom() []byte {
}
return bloom
}

func StringToTopic(s string) (t TopicType) {
str, _ := hexutil.Decode(s)
return BytesToTopic(str)
}

func TopicTypeToByteArray(t TopicType) []byte {
topic := make([]byte, 4)
for i, b := range t {
topic[i] = b
}
return topic
}
4 changes: 4 additions & 0 deletions multiaccounts/accounts/database.go
Original file line number Diff line number Diff line change
Expand Up @@ -977,3 +977,7 @@ func (db *Database) GifFavorites() (favorites json.RawMessage, err error) {
}
return favorites, nil
}

func (db *Database) GetNodeConfig() (*params.NodeConfig, error) {
return nodecfg.GetNodeConfig(db.db)
}
Loading

0 comments on commit 3e1eb0a

Please sign in to comment.