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

Content storage #14

Merged
merged 3 commits into from
Dec 13, 2023
Merged

Conversation

fearlessfe
Copy link

impl content storage #9

@@ -62,6 +64,16 @@ const (
PersistOfferRequestKind byte = 0x02
)

var ErrNilContentKey = errors.New("content key cannot be nil")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

shouldn't these all be moved to content_storage.go?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this err is return from the PortalProtocol before call the content_storage, so this should be in PortalProtocol


contentQueue chan *ContentElement
}

func NewPortalProtocol(config *PortalProtocolConfig, protocolId string, privateKey *ecdsa.PrivateKey, storage Storage, contentQueue chan *ContentElement) (*PortalProtocol, error) {
func defaultContentIdFunc(contentKey []byte) []byte {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same as above?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this should be in PortalProtocol, storage do not care about the contentKey to contentId

args[i] = id
}

// 执行删除操作
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

don't use Chinese comment

return res
}

func defaultContentIdFunc(contentKey []byte) []byte {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Duplicate?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes, I will delete it, the content storage not care about how the contentKey tranform to contentId

maxDistance = uint256.MustFromHex("0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff")
)

const (
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

const before var

ORDER BY distance DESC`
)

type ContentStorage struct {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

public method comments not follow go standard

@GrapeBaBa GrapeBaBa merged commit 195da39 into optimism-java:portal Dec 13, 2023
1 check passed
@fearlessfe fearlessfe deleted the content-storage branch September 5, 2024 02:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants