Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

user and replica set entity manager #3897

Merged
merged 40 commits into from
Sep 28, 2022
Merged
Changes from 1 commit
Commits
Show all changes
40 commits
Select commit Hold shift + click to select a range
daa65bc
add user entity manager
Aug 24, 2022
a2ff380
Update discovery user replica route and entity manager
jowlee Sep 20, 2022
abcd2f1
WIP CN check discovery vs chain
jowlee Sep 20, 2022
226f990
Update libs bindings for entity manager
jowlee Sep 20, 2022
f3d146b
lint discovery
jowlee Sep 20, 2022
bb3cf8f
Fix lint
isaacsolo Sep 20, 2022
9f712af
Turn on dev features
jowlee Sep 20, 2022
41d62d6
removediscovery logs
jowlee Sep 20, 2022
6ff89b4
Add wait for discovery indexing to cn replica set update
jowlee Sep 20, 2022
62cbca4
Fix libs type
jowlee Sep 20, 2022
124efa0
Fix lint
jowlee Sep 20, 2022
2cfe98a
fix api unit test
isaacsolo Sep 20, 2022
6df44fd
Update ns docs for api change
jowlee Sep 20, 2022
7d2ad97
Update gen types
jowlee Sep 20, 2022
8a9a2bf
FIx cn tests
jowlee Sep 21, 2022
fc0deac
Update sdk api
jowlee Sep 21, 2022
61b8686
Update user replica endpoint to return empty when not found
jowlee Sep 23, 2022
0007140
Address comments on cn middleware ensure primary
jowlee Sep 23, 2022
c02f193
Update libs to return err on discovery blocknumber makereq
jowlee Sep 23, 2022
bcc5bab
Put content entity manager and discovery validation behind env var
jowlee Sep 23, 2022
8185a26
Fix discovery lint
jowlee Sep 23, 2022
3678b38
Update creator node
jowlee Sep 26, 2022
432502f
Fix discovery indexing
jowlee Sep 26, 2022
f5d6606
fix libs
jowlee Sep 26, 2022
d93c12c
lint fix discovery
jowlee Sep 26, 2022
c4a27e8
add more entity manager flags and fix bugs w updates
isaacsolo Sep 26, 2022
fcc0ade
update entityManagerAddress in CN config and add handle_lc
isaacsolo Sep 26, 2022
4a838ba
fix types
isaacsolo Sep 27, 2022
b30e79b
Update local cn entity manager addr
jowlee Sep 27, 2022
10f976e
Add timeout to get user replica set
jowlee Sep 27, 2022
3b76a13
Update local env vs prod config for entity manager
jowlee Sep 27, 2022
2ddbf89
Address comments
jowlee Sep 28, 2022
db8523f
Merge branch 'master' into jowlee-user-entity-manager
jowlee Sep 28, 2022
47cc666
Fix merge err
jowlee Sep 28, 2022
536941c
Fix libs bug
jowlee Sep 28, 2022
2de10b3
fix libs lint
jowlee Sep 28, 2022
eaec22f
add comment on wait for repica set indexing
jowlee Sep 28, 2022
61f3516
Merge branch 'master' into jowlee-user-entity-manager
jowlee Sep 28, 2022
a032582
lint fix discovery after merge
jowlee Sep 28, 2022
af07a88
Fix metadata change test
jowlee Sep 28, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
removediscovery logs
jowlee committed Sep 26, 2022
commit 41d62d6a92d98a89e6707d388688aab8a8aacab5
11 changes: 3 additions & 8 deletions discovery-provider/src/api/v1/users.py
Original file line number Diff line number Diff line change
@@ -1097,14 +1097,6 @@ def get(self, id):
"users_by_content_node", full_ns, fields.List(fields.Nested(user_replica_set))
)

users_by_content_node_response = make_full_response(
"users_by_content_node", full_ns, fields.List(fields.Nested(user_replica_set))
)

user_replica_set_response = make_full_response(
"users_by_content_node", full_ns, fields.Nested(user_replica_set)
)


@full_ns.route("/content_node/<string:replica_type>", doc=False)
class UsersByContentNode(Resource):
@@ -1482,6 +1474,9 @@ def get(self):


GET_REPLICA_SET = "/<string:id>/replica_set"
user_replica_set_response = make_full_response(
"users_by_content_node", full_ns, fields.Nested(user_replica_set)
)


@full_ns.route(GET_REPLICA_SET)
10 changes: 4 additions & 6 deletions discovery-provider/src/tasks/entity_manager/user.py
Original file line number Diff line number Diff line change
@@ -20,7 +20,7 @@
logger = logging.getLogger(__name__)


def is_valid_user_tx(params: ManageEntityParameters):
def validate_user_tx(params: ManageEntityParameters):
user_id = params.user_id

if params.entity_type != EntityType.USER:
@@ -40,7 +40,6 @@ def is_valid_user_tx(params: ManageEntityParameters):
raise Exception(
"Invalid User Transaction, user wallet signer does not match"
)
return True


def update_user_record(params: ManageEntityParameters, user: User, metadata: Dict):
@@ -54,8 +53,8 @@ def update_user_record(params: ManageEntityParameters, user: User, metadata: Dic


def create_user(params: ManageEntityParameters):
if not is_valid_user_tx(params):
return
validate_user_tx(params)

user_id = params.user_id

user_record = User(
@@ -87,8 +86,7 @@ def create_user(params: ManageEntityParameters):


def update_user(params: ManageEntityParameters):
if not is_valid_user_tx(params):
return
validate_user_tx(params)

user_metadata = params.ipfs_metadata[params.metadata_cid]
user_id = params.entity_id