WIP: Json rpc federation, search/getclaimbyid, and shutdown #76

Merged
jeffreypicard merged 11 commits from json-rpc-federation-and-shutdown into master 2022-12-07 17:01:36 +01:00
3 changed files with 0 additions and 61 deletions
Showing only changes of commit 6c287425ef - Show all commits

View file

@ -670,7 +670,6 @@ func (db *ReadOnlyDBColumnFamily) Unwind() {
// Shutdown shuts down the db. // Shutdown shuts down the db.
func (db *ReadOnlyDBColumnFamily) Shutdown() { func (db *ReadOnlyDBColumnFamily) Shutdown() {
// db.Grp.StopAndWait()
log.Println("Calling cleanup...") log.Println("Calling cleanup...")
db.Cleanup() db.Cleanup()
log.Println("Leaving Shutdown...") log.Println("Leaving Shutdown...")

View file

@ -971,44 +971,6 @@ func (db *ReadOnlyDBColumnFamily) GetTxMerkle(tx_hashes []chainhash.Hash) ([]TxM
} }
func (db *ReadOnlyDBColumnFamily) GetClaimByID(claimID string) ([]*ExpandedResolveResult, []*ExpandedResolveResult, error) { func (db *ReadOnlyDBColumnFamily) GetClaimByID(claimID string) ([]*ExpandedResolveResult, []*ExpandedResolveResult, error) {
// claim, err := db.GetCachedClaimTxo(claimID, true)
// if err != nil {
// return nil, err
// }
// activation, err := db.GetActivation(claim.TxNum, claim.Position)
// if err != nil {
// return nil, err
// }
// return PrepareResolveResult(
// db,
// claim.TxNum,
// claim.Position,
// claimID,
// claim.Name,
// claim.RootTxNum,
// claim.RootPosition,
// activation,
// claim.ChannelSignatureIsValid,
// )
/*
def _getclaimbyid(self, claim_id: str):
rows = []
extra = []
claim_hash = bytes.fromhex(claim_id)
stream = self.db._fs_get_claim_by_hash(claim_hash)
rows.append(stream or LookupError(f"Could not find claim at {claim_id}"))
if stream and stream.channel_hash:
channel = self.db._fs_get_claim_by_hash(stream.channel_hash)
extra.append(channel or LookupError(f"Could not find channel at {stream.channel_hash.hex()}"))
if stream and stream.reposted_claim_hash:
repost = self.db._fs_get_claim_by_hash(stream.reposted_claim_hash)
if repost:
extra.append(repost)
return Outputs.to_base64(rows, extra, 0, None, None)
*/
rows := make([]*ExpandedResolveResult, 0) rows := make([]*ExpandedResolveResult, 0)
extras := make([]*ExpandedResolveResult, 0) extras := make([]*ExpandedResolveResult, 0)
claimHash, err := hex.DecodeString(claimID) claimHash, err := hex.DecodeString(claimID)

22
main.go
View file

@ -29,36 +29,14 @@ func main() {
if args.CmdType == server.ServeCmd { if args.CmdType == server.ServeCmd {
// This will cancel goroutines with the server finishes. // This will cancel goroutines with the server finishes.
// ctxWCancel, cancel := context.WithCancel(ctx)
// defer cancel()
stopGroup := stop.New() stopGroup := stop.New()
// defer stopGroup.Stop()
initsignals() initsignals()
interrupt := interruptListener() interrupt := interruptListener()
// s := server.MakeHubServer(ctxWCancel, args)
s := server.MakeHubServer(stopGroup, args) s := server.MakeHubServer(stopGroup, args)
go s.Run() go s.Run()
// defer func() {
// log.Println("Shutting down server...")
// if s.EsClient != nil {
// log.Println("Stopping es client...")
// s.EsClient.Stop()
// }
// if s.GrpcServer != nil {
// log.Println("Stopping grpc server...")
// s.GrpcServer.GracefulStop()
// }
// if s.DB != nil {
// log.Println("Stopping database connection...")
// s.DB.Shutdown()
// }
// log.Println("Returning from main...")
// }()
defer s.Stop() defer s.Stop()
<-interrupt <-interrupt