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

tatanka/client: separate network parts from mesh protocol parts #3176

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

buck54321
Copy link
Member

Separate the networking logic from the mesh protocol logic by splitting the old TankaClient into two parts. MeshConn handles connections to both tatanka nodes and peers. Mesh handles the client mesh protocol. Mesh is somewhat similar to core.dexConnection in its purpose.

Here's a taste of the separated APIs.

type TheConnectionPart interface {
	ConnectPeer(peerID tanka.PeerID) error
	RequestPeer(peerID tanka.PeerID, msg *msgjson.Message, thing any) (*mj.TankagramResult, error)
	Auth(tatankaID tanka.PeerID) error
	RequestMesh(msg *msgjson.Message, thing any, opts ...RequestOption) error
}

type TheMeshFunPart interface {
	ID() tanka.PeerID
	Next() <-chan any
	Broadcast(topic tanka.Topic, subject tanka.Subject, msgType mj.BroadcastMessageType, thing interface{}) error
	PostBond(bond *tanka.Bond) error
	ActiveBonds() ([]*tanka.Bond, error)
	SubscribeMarket(baseID, quoteID uint32) error
}

Mesh has its own database. That is where things like order info and bonds will be stored. I've implemented a bonds table to demonstrate.

Separate the networking logic from the mesh protocol logic by
splitting the old TankaClient into two parts. MeshConn handles
connections to both tatanka nodes and peers. Mesh handles the
client mesh protocol.

Mesh has its own database. That is where things like order info
and bonds will be stored.
@buck54321 buck54321 changed the title tatanka: separate network parts from mesh protocol parts tatanka/client: separate network parts from mesh protocol parts Feb 4, 2025
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.

1 participant