Claim search port #5

Merged
jeffreypicard merged 32 commits from claim_search_port into master 2021-06-23 17:07:41 +02:00
jeffreypicard commented 2021-05-18 12:05:31 +02:00 (Migrated from github.com)

closes #2

Still need to add tests and fix the response.

closes #2 Still need to add tests and fix the response.
shyba (Migrated from github.com) reviewed 2021-05-18 12:05:31 +02:00
lyoshenka (Migrated from github.com) requested changes 2021-06-16 00:00:45 +02:00
@ -0,0 +1,5 @@
FROM debian:10-slim
lyoshenka (Migrated from github.com) commented 2021-06-15 22:12:57 +02:00

what makes debian better than ubuntu or alpine?

what makes debian better than ubuntu or alpine?
@ -0,0 +1,4 @@
#!/bin/bash
go build .
sudo docker build . -t lbry/hub:latest
lyoshenka (Migrated from github.com) commented 2021-06-15 22:13:44 +02:00

sudo in a build script is not a good idea. i think you can use docker without sudo if you a dd yourself to the docker group

`sudo` in a build script is not a good idea. i think you can use docker without sudo if you a dd yourself to the docker group
@ -3,40 +3,167 @@ package main
import (
"context"
"fmt"
"github.com/lbryio/hub/util"
lyoshenka (Migrated from github.com) commented 2021-06-15 22:14:43 +02:00

plz sort imports like this

builtins

everything from lbryio 

everything else
plz sort imports like this ``` builtins everything from lbryio everything else ```
lyoshenka (Migrated from github.com) commented 2021-06-15 23:54:54 +02:00

i recommend putting *q as the first param in all these functions. its consistent and it's clear that you're adding to the query.

i recommend putting `*q` as the first param in all these functions. its consistent and it's clear that you're adding to the query.
lyoshenka (Migrated from github.com) commented 2021-06-15 23:55:34 +02:00

you don't need this if check. if array is empty then the loop won't be run

you don't need this if check. if array is empty then the loop won't be run
lyoshenka (Migrated from github.com) commented 2021-06-15 23:56:48 +02:00

or if you did wanna leave it, Go prefers the exit-early strategy over many levels of nesting (let me know if this isn't clear and i'll show you an example)

or if you did wanna leave it, Go prefers the exit-early strategy over many levels of nesting (let me know if this isn't clear and i'll show you an example)
@ -46,0 +142,4 @@
if err != nil {
log.Println(err)
return nil, err
}
lyoshenka (Migrated from github.com) commented 2021-06-15 23:58:17 +02:00

this function is massive. you could break it up into building the query and then doing the search. and maybe into even smaller chunks

this function is massive. you could break it up into building the query and then doing the search. and maybe into even smaller chunks
@ -58,0 +220,4 @@
Offset: uint32(int64(from) + searchResult.TotalHits()),
Blocked: blocked,
BlockedTotal: blockedTotal,
}, nil
lyoshenka (Migrated from github.com) commented 2021-06-15 23:59:58 +02:00

by convention ctx is generally the first param

by convention `ctx` is generally the first param
@ -0,0 +1,47 @@
package util
lyoshenka (Migrated from github.com) commented 2021-06-15 23:50:20 +02:00

in my experience, packages like this turn into a disorganized heap of stuff. i recommend moving these into the package where you use them, or putting them somewhere in lbry.go as functions that normalize names and convert hashes to txids

in my experience, packages like this turn into a disorganized heap of stuff. i recommend moving these into the package where you use them, or putting them somewhere in lbry.go as functions that normalize names and convert hashes to txids
lyoshenka (Migrated from github.com) commented 2021-06-15 23:50:49 +02:00

if you don't want them in lbry.go, you can make the package here. but make it about what its about instead of a generic util

if you don't want them in lbry.go, you can make the package here. but make it about what its about instead of a generic `util`
jeffreypicard (Migrated from github.com) reviewed 2021-06-18 01:25:01 +02:00
@ -0,0 +1,4 @@
#!/bin/bash
go build .
sudo docker build . -t lbry/hub:latest
jeffreypicard (Migrated from github.com) commented 2021-06-18 01:25:01 +02:00

You're right, I set this up on a new ubuntu system and was too lazy to do that.

You're right, I set this up on a new ubuntu system and was too lazy to do that.
jeffreypicard (Migrated from github.com) reviewed 2021-06-18 01:26:03 +02:00
@ -0,0 +1,47 @@
package util
jeffreypicard (Migrated from github.com) commented 2021-06-18 01:26:03 +02:00

I think moving them into lbry.go is probably a good idea, I could see these being used elsewhere, I'll do that.

I think moving them into lbry.go is probably a good idea, I could see these being used elsewhere, I'll do that.
jeffreypicard (Migrated from github.com) reviewed 2021-06-18 01:27:08 +02:00
jeffreypicard (Migrated from github.com) commented 2021-06-18 01:27:08 +02:00

Agreed

Agreed
jeffreypicard (Migrated from github.com) reviewed 2021-06-18 01:31:22 +02:00
jeffreypicard (Migrated from github.com) commented 2021-06-18 01:31:21 +02:00

Yeah, I'll remove the check, I'm pretty sure I know what you're talking about with the exit-early strategy, you do the checks first for default cases and return in those, and then don't have the ifs around the main code. It's the same style as I learned in C, should have remembered that :)

Yeah, I'll remove the check, I'm pretty sure I know what you're talking about with the exit-early strategy, you do the checks first for default cases and return in those, and then don't have the ifs around the main code. It's the same style as I learned in C, should have remembered that :)
jeffreypicard (Migrated from github.com) reviewed 2021-06-18 01:31:55 +02:00
@ -58,0 +220,4 @@
Offset: uint32(int64(from) + searchResult.TotalHits()),
Blocked: blocked,
BlockedTotal: blockedTotal,
}, nil
jeffreypicard (Migrated from github.com) commented 2021-06-18 01:31:54 +02:00

Makes sense

Makes sense
jeffreypicard (Migrated from github.com) reviewed 2021-06-18 01:36:57 +02:00
@ -0,0 +1,5 @@
FROM debian:10-slim
jeffreypicard (Migrated from github.com) commented 2021-06-18 01:36:57 +02:00

I think I copied this from somewhere originally, but I can't find the original now, there wasn't really any thought behind it. Do we generally use alpine? I do think maybe ubuntu would be a bit bigger than needed since it's a static binary with no dependencies.

I think I copied this from somewhere originally, but I can't find the original now, there wasn't really any thought behind it. Do we generally use alpine? I do think maybe ubuntu would be a bit bigger than needed since it's a static binary with no dependencies.
jeffreypicard (Migrated from github.com) reviewed 2021-06-18 04:38:12 +02:00
@ -0,0 +1,5 @@
FROM debian:10-slim
jeffreypicard (Migrated from github.com) commented 2021-06-18 04:38:12 +02:00

Found it, this is why I used debian, copied from here https://github.com/lbryio/lbry-sdk/blob/master/docker/Dockerfile.wallet_server#L1

Found it, this is why I used debian, copied from here https://github.com/lbryio/lbry-sdk/blob/master/docker/Dockerfile.wallet_server#L1
lyoshenka (Migrated from github.com) reviewed 2021-06-21 22:46:24 +02:00
@ -0,0 +1,5 @@
FROM debian:10-slim
lyoshenka (Migrated from github.com) commented 2021-06-21 22:46:24 +02:00

@shyba why did you use debian and not alpine or ubuntu?

@shyba why did you use debian and not alpine or ubuntu?
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference: LBRYCommunity/herald.go#5
No description provided.