New Storage Refactor #404
Labels
No Label
applications
BLOCKED
bug
design
duplicate
enhancement
fixed?
funding-needed
help wanted
infrastructure
invalid
payments
qubes
question
ready-for-implementation
refactor
spam
tapir-server
testing
tor
wontfix
No Milestone
4 Participants
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: cwtch.im/cwtch#404
Loading…
Reference in New Issue
No description provided.
Delete Branch "p2p-interim-new-storage"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Significant refactor for the new storage engine plus laying the ground work for hybrid groups.
conversations
andchannels
instead ofcontacts
andgroups
Profile
andPublicProfile
Groups
asLegacyGroups
ConversationID
instead ofRemotePeer
orGroupID
i.e. "a move towards a hybrid interface"There are libcwtch-go, server and ui changes associated with this work.
This change is backwards compatible as far as the network interface goes.
This chaange makes significant enough changes to warrant a major version increase of Cwtch and libCwtch-go
Still some minor todos (see below), but ready for general comments.
TODO:
UpdateMessageAttributes
API into the UIDrone Build Status: failure
https://build.openprivacy.ca/cwtch.im/cwtch/499
@ -147,3 +122,3 @@
defer app.appmutex.Unlock()
if app.storage[onion].CheckPassword(password) {
if app.peers[onion].CheckPassword(password) {
delete commented out code?
@ -166,3 +137,4 @@
log.Debugf("Delete peer for %v Done\n", onion)
app.appBus.Publish(event.NewEventList(event.PeerDeleted, event.Identity, onion))
return
ditto delete
@ -166,3 +137,4 @@
log.Debugf("Delete peer for %v Done\n", onion)
app.appBus.Publish(event.NewEventList(event.PeerDeleted, event.Identity, onion))
return
return will never happen as delete above it
@ -481,53 +64,53 @@ func getRandomness(arr *[]byte) {
}
}
// GenerateRandomID generates a random 16 byte hex id code
dup? it's also in app
GenerateRandomID is still dupped in model/profile and app/app
Drone Build Status: failure
https://build.openprivacy.ca/cwtch.im/cwtch/505
Drone Build Status: failure
https://build.openprivacy.ca/cwtch.im/cwtch/507
Drone Build Status: failure
https://build.openprivacy.ca/cwtch.im/cwtch/509
Drone Build Status: failure
https://build.openprivacy.ca/cwtch.im/cwtch/511
Drone Build Status: failure
https://build.openprivacy.ca/cwtch.im/cwtch/513
Drone Build Status: failure
https://build.openprivacy.ca/cwtch.im/cwtch/514
@ -110,0 +89,4 @@
func GenerateRandomID() string {
randBytes := make([]byte, 16)
rand.Read(randBytes)
return path.Join(hex.EncodeToString(randBytes))
uhhh
@ -203,0 +168,4 @@
} else { // On failure attempt to load a legacy profile
profileStore, err := storage.LoadProfileWriterStore(profileDirectory, password)
if err != nil {
continue
log
@ -228,0 +200,4 @@
count++
} else {
// Otherwise shutdown the connections
profile.Shutdown()
why?
@ -25,7 +25,7 @@ type Functionality struct {
// FunctionalityGate returns contact.Functionality always
comment seems wrong lol
@ -0,0 +64,4 @@
// GetAttribute is a helper function that fetches a conversation attribute by scope, zone and key
func (ci *Conversation) GetAttribute(scope attr.Scope, zone attr.Zone, key string) (string, bool) {
if value, exists := ci.Attributes[scope.ConstructScopedZonedPath(zone.ConstructZonedPath(key)).ToString()]; exists {
this syntax is a little painful
@ -0,0 +75,4 @@
if _, exists := ci.Attributes[attr.LocalScope.ConstructScopedZonedPath(attr.LegacyGroupZone.ConstructZonedPath(constants.GroupID)).ToString()]; exists {
return true
}
return false
....if true return true, else return false....
I agree, but current linting in quality.sh does not.
@ -0,0 +83,4 @@
if _, exists := ci.Attributes[attr.PublicScope.ConstructScopedZonedPath(attr.ServerKeyZone.ConstructZonedPath(string(BundleType))).ToString()]; exists {
return true
}
return false
"
@ -0,0 +10,4 @@
func CalculateContentHash(author string, messageBody string) string {
content := []byte(author + messageBody)
contentBasedHash := sha256.Sum256(content)
return base64.StdEncoding.EncodeToString(contentBasedHash[:])
add timestamp or something? otherwise this generates lotsa duplicates
we cannot as content hash must be the same for all members of a conversation.
@ -0,0 +50,4 @@
channelGetMessageBySignatureStmts map[ChannelID]*sql.Stmt
channelGetCountStmts map[ChannelID]*sql.Stmt
channelGetMostRecentMessagesStmts map[ChannelID]*sql.Stmt
channelGetMessageByContentHashStmts map[ChannelID]*sql.Stmt
statements are threadsafe but these maps are not
@ -0,0 +141,4 @@
return nil, err
}
acceptConversationStmt, err := db.Prepare(acceptedConversationSQLStmt)
accept/accepted
@ -0,0 +264,4 @@
return int(conversationID), nil
}
// GetConversationByHandle is a convienance method to fetch an active conversation by a handle
convenience
@ -0,0 +332,4 @@
}
}
// GetConversation looks up a particular conversation by handle
by id*
Drone Build Status: success
https://build.openprivacy.ca/cwtch.im/cwtch/516
signature := event.GetRandNumber().String()
why?
RE: GetOnion - the point of deprecation is that it's an API that shouldn't be assumed to exist in the future. If clients want onion they should get it via the Attributes API.
App currently uses it to detect unique profiles. Ideally in the future it should define a uuid or something, and eventually the ui should phase out ProfileOnion for that uuid. But that is a bigger change that is beyond the scope.
Drone Build Status: failure
https://build.openprivacy.ca/cwtch.im/cwtch/518
Drone Build Status: success
https://build.openprivacy.ca/cwtch.im/cwtch/520
Drone Build Status: failure
https://build.openprivacy.ca/cwtch.im/cwtch/524
Drone Build Status: failure
https://build.openprivacy.ca/cwtch.im/cwtch/526
Drone Build Status: success
https://build.openprivacy.ca/cwtch.im/cwtch/528
Drone Build Status: failure
https://build.openprivacy.ca/cwtch.im/cwtch/532
Drone Build Status: success
https://build.openprivacy.ca/cwtch.im/cwtch/534
WIP: New Storage Refactorto New Storage Refactor