1
0
Fork 0
mirror of https://github.com/anyproto/any-sync.git synced 2025-06-08 05:57:03 +09:00
This commit is contained in:
Anatolii Smolianinov 2025-04-28 14:50:16 +02:00
parent 6bd04f900c
commit 74d0619ccd
No known key found for this signature in database
GPG key ID: 2DFC2826A71FE8A0
6 changed files with 1 additions and 172 deletions

4
.gitignore vendored
View file

@ -32,7 +32,3 @@ db
# Dependency directories (remove the comment below to include it)
# vendor/
# ignore envrc, used for direnv + flake
/.envrc
/.direnv/

View file

@ -47,4 +47,4 @@ test:
replace-gogo-strings:
@echo "Replacing 'github.com/gogo/protobuf' with 'github.com/anyproto/protobuf' in all files recursively..."
LC_CTYPE=C LANG=C find . -type f -name "*.go" | xargs sed -i "s|github.com/gogo/protobuf|github.com/anyproto/protobuf|g"
LC_CTYPE=C LANG=C find . -type f -name "*.go" | xargs sed -i '' "s|github.com/gogo/protobuf|github.com/anyproto/protobuf|g"

View file

@ -26,7 +26,6 @@ func New() SubscribeClientService {
type EventCallback func(*coordinatorproto.NotifySubscribeEvent)
type SubscribeClientService interface {
// `id` is just some id which is used to unsubscribe
Subscribe(eventType coordinatorproto.NotifyEventType, callback EventCallback) error
app.ComponentRunnable
}
@ -123,7 +122,6 @@ func (s *subscribeClient) streamWatcher() {
log.Info("streamWatcher: open inbox stream")
if st, err = s.openStream(s.ctx); err != nil {
// can't open stream, we will retry until success connection or close
if i < 60 {
i++
}
@ -159,8 +157,6 @@ func (s *subscribeClient) streamReader() error {
if err != nil {
return err
}
// disapatch event to listener
s.mucb.Lock()
if receiver, ok := s.callbacks[event.EventType]; ok {

View file

@ -29,8 +29,6 @@ type stream struct {
isShutdown atomic.Bool
}
// if close, reconnect
// if shutdown, don't try more
func (s *stream) WaitNotifyEvents(ctx context.Context) (*coordinatorproto.NotifySubscribeEvent, error) {
event, err := s.mb.WaitOne(ctx)
if err != nil {

126
flake.lock generated
View file

@ -1,126 +0,0 @@
{
"nodes": {
"drpc": {
"inputs": {
"flake-utils": "flake-utils",
"nixpkgs": "nixpkgs"
},
"locked": {
"lastModified": 1710270657,
"narHash": "sha256-hjb+8iB0HTdAYtsOvr6gY2yhwdg2NLUqQRVJi4qMmJI=",
"owner": "storj",
"repo": "drpc",
"rev": "a5d487af8ae33deb7913b0f7c06b2c7ec7cd4dcc",
"type": "github"
},
"original": {
"owner": "storj",
"ref": "v0.0.34",
"repo": "drpc",
"type": "github"
}
},
"flake-utils": {
"inputs": {
"systems": "systems"
},
"locked": {
"lastModified": 1710146030,
"narHash": "sha256-SZ5L6eA7HJ/nmkzGG7/ISclqe6oZdOZTNoesiInkXPQ=",
"rev": "b1d9ab70662946ef0850d488da1c9019f3a9752a",
"revCount": 92,
"type": "tarball",
"url": "https://api.flakehub.com/f/pinned/numtide/flake-utils/0.1.92%2Brev-b1d9ab70662946ef0850d488da1c9019f3a9752a/018e2ca5-e5a2-7f80-9261-445a8cecd4d7/source.tar.gz"
},
"original": {
"type": "tarball",
"url": "https://flakehub.com/f/numtide/flake-utils/%2A.tar.gz"
}
},
"flake-utils_2": {
"inputs": {
"systems": "systems_2"
},
"locked": {
"lastModified": 1731533236,
"narHash": "sha256-l0KFg5HjrsfsO/JpG+r7fRrqm12kzFHyUHqHCVpMMbI=",
"owner": "numtide",
"repo": "flake-utils",
"rev": "11707dc2f618dd54ca8739b309ec4fc024de578b",
"type": "github"
},
"original": {
"owner": "numtide",
"repo": "flake-utils",
"type": "github"
}
},
"nixpkgs": {
"locked": {
"lastModified": 1710162809,
"narHash": "sha256-i2R2bcnQp+85de67yjgZVvJhd6rRnJbSYNpGmB6Leb8=",
"rev": "ddcd7598b2184008c97e6c9c6a21c5f37590b8d2",
"revCount": 556648,
"type": "tarball",
"url": "https://api.flakehub.com/f/pinned/NixOS/nixpkgs/0.2311.556648%2Brev-ddcd7598b2184008c97e6c9c6a21c5f37590b8d2/018e3162-e13b-7219-a0b5-da03bcc09ecc/source.tar.gz"
},
"original": {
"type": "tarball",
"url": "https://flakehub.com/f/NixOS/nixpkgs/%2A.tar.gz"
}
},
"nixpkgs_2": {
"locked": {
"lastModified": 1741173522,
"narHash": "sha256-k7VSqvv0r1r53nUI/IfPHCppkUAddeXn843YlAC5DR0=",
"rev": "d69ab0d71b22fa1ce3dbeff666e6deb4917db049",
"revCount": 762848,
"type": "tarball",
"url": "https://api.flakehub.com/f/pinned/NixOS/nixpkgs/0.1.762848%2Brev-d69ab0d71b22fa1ce3dbeff666e6deb4917db049/0195698a-02df-791f-8cd3-d10c16d442f0/source.tar.gz"
},
"original": {
"type": "tarball",
"url": "https://flakehub.com/f/NixOS/nixpkgs/0.1.0.tar.gz"
}
},
"root": {
"inputs": {
"drpc": "drpc",
"flake-utils": "flake-utils_2",
"nixpkgs": "nixpkgs_2"
}
},
"systems": {
"locked": {
"lastModified": 1681028828,
"narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=",
"owner": "nix-systems",
"repo": "default",
"rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e",
"type": "github"
},
"original": {
"owner": "nix-systems",
"repo": "default",
"type": "github"
}
},
"systems_2": {
"locked": {
"lastModified": 1681028828,
"narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=",
"owner": "nix-systems",
"repo": "default",
"rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e",
"type": "github"
},
"original": {
"owner": "nix-systems",
"repo": "default",
"type": "github"
}
}
},
"root": "root",
"version": 7
}

View file

@ -1,35 +0,0 @@
{
description = "";
inputs.nixpkgs.url = "https://flakehub.com/f/NixOS/nixpkgs/0.1.0.tar.gz";
inputs.flake-utils.url = "github:numtide/flake-utils";
inputs.drpc.url = "github:storj/drpc/v0.0.34";
outputs = { self, nixpkgs, drpc, flake-utils, ... }:
flake-utils.lib.eachDefaultSystem (system: let
pkgs = import nixpkgs {
inherit system;
config = { allowUnfree = true; };
};
# any-protoc-gen-gogofaster = pkgs.callPackage ./nix/any-protoc-gen-gogofaster.nix {};
# protoc-gen-go-drpc = drpc.defaultPackage.${system};
in {
devShell = pkgs.mkShell {
name = "any-sync";
nativeBuildInputs = [
# our forked proto generator
# any-protoc-gen-gogofaster
# drpc generator
# protoc-gen-go-drpc
pkgs.go_1_23
# pkgs.gox
pkgs.protobuf3_21
pkgs.pkg-config
pkgs.pre-commit
# todo: govvv, not packaged
];
};
});
}