• l4_700757
  • 1.7MB
  • zip
  • 0
  • VIP专享
  • 0
  • 2022-05-19 11:11
P2P字典 P2P词典是用于局域网上多个节点的分布式键值存储。 每个节点将订阅键值对的子集。 键-值对在节点之间根据需要复制,以到达另一个节点。 与大多数NoSQL实现类似,它不提供SQL接口或保证ACID(原子性,一致性,隔离性,持久性)。 P2P词典将在使用LAN发现技术(例如Apple Bonjour,Zeroconf,UDP广播)或公共网络中任何可访问的IP地址发现的局域网上运行。 客户端可以发现或连接对等链接。 P2P词典提供了用 , 和编写的服务器。 P2P服务器提供了一个REST接口,用于对键值对的只读访问。 提供了一个Web界面,供Web浏览器访问存储在每个节点上的键值对。 使用具有.NET和Java实现的Docker容器提供了可重新分发的程序包。 冯国Richard(C)2011-2018,版权所有 执照 您同意使用本软件之前的许可。 基本要求 所有平台: Lin
P2P Dictionary ============== P2P Dictionary is a distributed key-value store for multiple nodes on a local area network. Each node will subscribe to a subset of key-value pairs. Key-value pairs are replicated as necessary between nodes to reach to another node. Similar to most NoSQL implementations, it does not provide an SQL interface or guarantee ACID (atomicity, consistency, isolation, durability). P2P dictionary will run on a local area network discovered using LAN discovery technologies (e.g., Apple Bonjour, Zeroconf, UDP broadcast) or any reachable IP address in a public network. Peer links can be discovered or connected by the client. P2P dictionary provides a server written in [.NET Framework](https://github.com/rhfung/p2p-dictionary-csharp), [.NET Core](https://github.com/rhfung/p2p-dictionary-csharp), and [Java JVM](https://github.com/rhfung/p2p-dictionary). A REST interface is provided by the P2P server for read-only access to key-value pairs. A web interface is provided for web browser access to key-value pairs stored on each node. A redistributable package is provided using Docker containers with both .NET and Java implementations. Copyright (C) 2011-2018, Richard H Fung License ------- You agree to the LICENSE before using this Software. Basic requirements ------------------ All platforms: * Microsoft .NET Core 2.x on Linux, Mac, or Windows For redistributable: * Docker 17.05 or higher For Mac: * Visual Studio Code, or * Visual Studio for Mac For Windows: * Microsoft Visual Studio 2017 * Microsoft .NET Framework 4.6.1 on Windows * Requires Apple Bonjour Print Services for Windows: http://support.apple.com/kb/DL999 Getting Started --------------- Several example projects using P2P Dictionary are in the ''examples'' directory. Documentation ------------- ### Performance * Fastest response time for dictionary updates is 8 ms. ### Methods P2PDictionary methods conform to IDictionary interface. Additional methods are: Additional dictionary methods: * `Clear()` removes all dictionary entries owned by this dictionary * `GetValue(key,msTimeout)` blocking call to read from the dictionary, waits for msTimeout, throws IndexOutOfRangeException * `TryGetValue(key)` blocking call to read from the dictionary, returns false if cannot get the value * `TryGetValue(key,msTimeOut)` blocking call to read from the dictionary, waits for msTimeout, returns false if cannot get the value * `AddSubscription("pattern")` adds a subscription that matches the pattern. Pattern matching is Visual Basic patterns (* for many characters, ? for a single character) Control methods: * `Abort()` force close all incoming and outgoing connections * `Close()` safely close all incoming and outgoing connections * `ConstructNetwork()` searches for peers on the network using Apple Bonjour -- must be enabled ahead of time?? * `GetSubscriptions()` returns a list of subscriptions (subscribed patterns) * `OpenClient()` opens a client connection to a known remote peer * `OpenServer()` opens a server instance if not already specified on constructor * `RemoveSubscription()` removes a previously added subscription '''not tested''' Static methods: * `P2PDictionary.GetFreePort(port)` returns the next open free port at or above the specified value. Throws ApplicationException if the port cannot be found. ### Properties * `DebugBuffer` sets/gets the buffer for debug messages * `Description` returns the friendly name for the dictionary, assigned on constructor * `LocalEndPoint` returns the IP address of the server * `LocalID` returns a unique ID number for the dictionary, should be unique to all peers * `Namespace` returns the namespace provided on constructor, must be the same to all peers on the network * `RemotePeersCount` returns the number of remotely connected peers ### Events * `Connected` when a peer joins * `ConnectionFailure` when a peer fails to join * `Disconnected` when a peer departs * `Notified` when a subscribed dictionary key is added, changed, or removed * `SubscriptionChanged` when a subscription changes Building -------- Build on Linux/Mac using Docker. Example commands: cd <SOURCEDIR> docker build -t p2pd-csharp . docker run -p 8800:8800 -it p2pd-csharp -s test -p 8800 And open http://localhost:8800 to see the running server. Get additional commands using (see next section for detail): docker run -p 8800:8800 -it p2pd-csharp --help Command Line Interface ---------------------- The CLI `p2pd` and `p2pwin` support the following arguments: -m, --description (Default: ) Description for the server -p, --port (Default: 8765) Bind to port -s, --namespace Required. Namespace for the server -t, --timespan (Default: 1500) Search interval for clients -d, --discovery Specify a backend discovery mechanism, defaults to none --nopattern Monitors no patterns --pattern Monitors a specific pattern using wildcard (*), single character (?), and number (#) placeholders; default to * -n Provide clients in the form host:port --debug --fulldebug Change Log ---------- * 2.1 * added supported for .NET Core 2.0 * upgraded to .NET Framework 4.6.1 and Visual Studio 2017 * added in required constructor argument for `IPeerInterface` and default discovery module `NoDiscovery` * added CLI for [Windows p2pwin](src/p2pwin) and [Linux p2pd](src/p2pd) * new discovery module [P2PDictionary.Peers.Zeroconf](src/P2PDictionary.Peers.Zeroconf) for `ZeroconfDiscovery` module that was previously enabled by default * 2.0 * new REST API * Bonjour registration * support for any MIME type * not compatible with 1.6.3