Refactor common accessor functions of internal and remote NodeState to a type class with 2 types #20
Labels
No labels
ActivityPub
advanced features
basic functionality
bug
DHT
evaluation
refactoring
security
test case
No milestone
No project
No assignees
1 participant
Notifications
Total time spent: 4 hours 50 minutes
Due date
schmittlauch
4 hours 50 minutes
No due date set.
Dependencies
No dependencies set.
Reference: schmittlauch/Hash2Pub#20
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
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?
Currently,
NodeState
is used for representing both the internal local nodes. As the local nodes contain local configuration parameters not present in the representation of remote nodes, thisInternalNodeState
is wrapped into a Maybe.But these parameteres are mostly accessed in functions that deal with local nodes only anyways. That renders the case disticntion between Just and Nothing to be unnecessary boilerplate.
Proposal:
Create a new type class that contains the accessor functions for values present in both NodeState types. Rename the the current
NodeState
without internals toRemoteNodeState
. TheLocalNodeState
is a composite type that holds aRemoteNodeState
and the internal values, with accessor functions designed to remove that composition indirection.