Compare commits
9 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 7639daa564 | |||
| 60e5043d0c | |||
| 690272d427 | |||
| 0b272e0e69 | |||
| 9dea7a2334 | |||
| 822c579cb6 | |||
| c5f5eb1f14 | |||
| 88b7bbd797 | |||
| 46bac78888 |
@@ -1,65 +1,12 @@
|
||||
name: CI
|
||||
on:
|
||||
push:
|
||||
paths-ignore:
|
||||
- 'docs/**'
|
||||
- '*.md'
|
||||
- '.mailmap'
|
||||
workflow_dispatch:
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
permissions: {}
|
||||
|
||||
jobs:
|
||||
linux:
|
||||
name: ${{ matrix.compiler }} on ${{ matrix.os }}
|
||||
runs-on: ${{ matrix.os }}
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
os: [ubuntu-20.04]
|
||||
compiler: [g++-7, g++-8, g++-9, g++-10,
|
||||
clang++-7, clang++-8, clang++-9, clang++-10, clang++-11, clang++-12]
|
||||
include:
|
||||
- os: ubuntu-22.04
|
||||
compiler: g++-11
|
||||
- os: ubuntu-22.04
|
||||
compiler: g++-12
|
||||
- os: ubuntu-22.04
|
||||
compiler: clang++-13
|
||||
- os: ubuntu-22.04
|
||||
compiler: clang++-14
|
||||
env:
|
||||
CXX: ${{ matrix.compiler }}
|
||||
steps:
|
||||
- name: Install C++ compiler
|
||||
run: |
|
||||
sudo apt-get -qy install ${CXX/clang++/clang}
|
||||
${CXX} --version
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v3
|
||||
- name: Build and test
|
||||
run: ./.jenkins
|
||||
|
||||
macos:
|
||||
name: Xcode ${{ matrix.xcode }} on ${{ matrix.os }}
|
||||
runs-on: ${{ matrix.os }}
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
os: [macos-11]
|
||||
xcode: ['12.4', '12.5', '13.2']
|
||||
include:
|
||||
- os: macos-12
|
||||
xcode: '13.4'
|
||||
- os: macos-12
|
||||
xcode: '14.2'
|
||||
steps:
|
||||
- name: Set up Xcode
|
||||
uses: maxim-lobanov/setup-xcode@v1
|
||||
with:
|
||||
xcode-version: ${{ matrix.xcode }}
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v3
|
||||
- name: Build and test
|
||||
run: ./.jenkins
|
||||
Ubuntu:
|
||||
uses: named-data/actions/.github/workflows/jenkins-script-ubuntu.yml@v1
|
||||
macOS:
|
||||
uses: named-data/actions/.github/workflows/jenkins-script-macos.yml@v1
|
||||
|
||||
+12
-26
@@ -1,33 +1,19 @@
|
||||
name: Docs
|
||||
on:
|
||||
push:
|
||||
paths-ignore:
|
||||
- '*.md'
|
||||
- '.mailmap'
|
||||
workflow_dispatch:
|
||||
inputs:
|
||||
skip-deploy:
|
||||
description: 'Skip deployment?'
|
||||
required: true
|
||||
type: boolean
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
permissions: {}
|
||||
|
||||
jobs:
|
||||
build:
|
||||
runs-on: ${{ matrix.os }}
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
os: [macos-latest, ubuntu-latest]
|
||||
env:
|
||||
JOB_NAME: Docs
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v3
|
||||
- name: Install dependencies
|
||||
run: |
|
||||
find .jenkins.d/ -type f -name '[1-9]*.sh' -exec chmod -x '{}' +
|
||||
./.jenkins
|
||||
- name: Build documentation
|
||||
run: |
|
||||
pybindir=$(python3 -c 'import sysconfig; print(sysconfig.get_path("scripts", "posix_user"))')
|
||||
export PATH="${pybindir}${PATH:+:}${PATH}"
|
||||
./waf --color=yes configure
|
||||
./waf --color=yes docs
|
||||
html:
|
||||
uses: named-data/actions/.github/workflows/docs-html.yml@v1
|
||||
with:
|
||||
# Deploy only the master branch and release tags
|
||||
deploy: ${{ !inputs.skip-deploy && (github.ref == 'refs/heads/master' || startsWith(github.ref, 'refs/tags/0.')) }}
|
||||
secrets: inherit
|
||||
|
||||
@@ -32,6 +32,9 @@ if [[ $JOB_NAME == *"code-coverage" ]]; then
|
||||
export DISABLE_HEADERS_CHECK=yes
|
||||
fi
|
||||
|
||||
# https://reproducible-builds.org/docs/source-date-epoch/
|
||||
export SOURCE_DATE_EPOCH=$(git log -1 --format=%ct)
|
||||
|
||||
for file in .jenkins.d/*; do
|
||||
[[ -f $file && -x $file ]] || continue
|
||||
|
||||
|
||||
@@ -3,10 +3,12 @@
|
||||
import platform
|
||||
from waflib import Configure, Logs, Utils
|
||||
|
||||
|
||||
def options(opt):
|
||||
opt.add_option('--debug', '--with-debug', action='store_true', default=False,
|
||||
help='Compile in debugging mode with minimal optimizations (-Og)')
|
||||
|
||||
|
||||
def configure(conf):
|
||||
conf.start_msg('Checking C++ compiler version')
|
||||
|
||||
@@ -18,19 +20,22 @@ def configure(conf):
|
||||
if cxx == 'gcc':
|
||||
if ccver < (7, 4, 0):
|
||||
errmsg = ('The version of gcc you are using is too old.\n'
|
||||
'The minimum supported gcc version is 7.4.')
|
||||
'The minimum supported gcc version is 9.3.')
|
||||
elif ccver < (9, 3, 0):
|
||||
warnmsg = ('Using a version of gcc older than 9.3 is not '
|
||||
'officially supported and may result in build failures.')
|
||||
conf.flags = GccFlags()
|
||||
elif cxx == 'clang':
|
||||
if Utils.unversioned_sys_platform() == 'darwin':
|
||||
if ccver < (10, 0, 0):
|
||||
errmsg = ('The version of Xcode you are using is too old.\n'
|
||||
'The minimum supported Xcode version is 11.3.')
|
||||
elif ccver < (11, 0, 0):
|
||||
warnmsg = ('Using a version of Xcode older than 11.3 is not '
|
||||
'The minimum supported Xcode version is 12.4.')
|
||||
elif ccver < (12, 0, 0):
|
||||
warnmsg = ('Using a version of Xcode older than 12.4 is not '
|
||||
'officially supported and may result in build failures.')
|
||||
elif ccver < (6, 0, 0):
|
||||
elif ccver < (7, 0, 0):
|
||||
errmsg = ('The version of clang you are using is too old.\n'
|
||||
'The minimum supported clang version is 6.0.')
|
||||
'The minimum supported clang version is 7.0.')
|
||||
conf.flags = ClangFlags()
|
||||
else:
|
||||
warnmsg = f'{cxx} compiler is unsupported'
|
||||
@@ -45,7 +50,7 @@ def configure(conf):
|
||||
else:
|
||||
conf.end_msg(ccverstr)
|
||||
|
||||
conf.areCustomCxxflagsPresent = (len(conf.env.CXXFLAGS) > 0)
|
||||
conf.areCustomCxxflagsPresent = len(conf.env.CXXFLAGS) > 0
|
||||
|
||||
# General flags are always applied (e.g., selecting C++ language standard)
|
||||
generalFlags = conf.flags.getGeneralFlags(conf)
|
||||
@@ -53,6 +58,7 @@ def configure(conf):
|
||||
conf.add_supported_linkflags(generalFlags['LINKFLAGS'])
|
||||
conf.env.DEFINES += generalFlags['DEFINES']
|
||||
|
||||
|
||||
@Configure.conf
|
||||
def check_compiler_flags(conf):
|
||||
# Debug or optimized CXXFLAGS and LINKFLAGS are applied only if the
|
||||
@@ -75,10 +81,11 @@ def check_compiler_flags(conf):
|
||||
|
||||
conf.env.DEFINES += extraFlags['DEFINES']
|
||||
|
||||
|
||||
@Configure.conf
|
||||
def add_supported_cxxflags(self, cxxflags):
|
||||
"""
|
||||
Check which cxxflags are supported by compiler and add them to env.CXXFLAGS variable
|
||||
Check which cxxflags are supported by the active compiler and add them to env.CXXFLAGS variable.
|
||||
"""
|
||||
if len(cxxflags) == 0:
|
||||
return
|
||||
@@ -94,10 +101,11 @@ def add_supported_cxxflags(self, cxxflags):
|
||||
self.end_msg(' '.join(supportedFlags))
|
||||
self.env.prepend_value('CXXFLAGS', supportedFlags)
|
||||
|
||||
|
||||
@Configure.conf
|
||||
def add_supported_linkflags(self, linkflags):
|
||||
"""
|
||||
Check which linkflags are supported by compiler and add them to env.LINKFLAGS variable
|
||||
Check which linkflags are supported by the active compiler and add them to env.LINKFLAGS variable.
|
||||
"""
|
||||
if len(linkflags) == 0:
|
||||
return
|
||||
@@ -114,13 +122,17 @@ def add_supported_linkflags(self, linkflags):
|
||||
self.env.prepend_value('LINKFLAGS', supportedFlags)
|
||||
|
||||
|
||||
class CompilerFlags(object):
|
||||
class CompilerFlags:
|
||||
def getCompilerVersion(self, conf):
|
||||
return tuple(int(i) for i in conf.env.CC_VERSION)
|
||||
|
||||
def getGeneralFlags(self, conf):
|
||||
"""Get dict of CXXFLAGS, LINKFLAGS, and DEFINES that are always needed"""
|
||||
return {'CXXFLAGS': [], 'LINKFLAGS': [], 'DEFINES': []}
|
||||
return {
|
||||
'CXXFLAGS': [],
|
||||
'LINKFLAGS': [],
|
||||
'DEFINES': ['BOOST_ASIO_NO_DEPRECATED', 'BOOST_FILESYSTEM_NO_DEPRECATED'],
|
||||
}
|
||||
|
||||
def getDebugFlags(self, conf):
|
||||
"""Get dict of CXXFLAGS, LINKFLAGS, and DEFINES that are needed only in debug mode"""
|
||||
@@ -130,94 +142,100 @@ class CompilerFlags(object):
|
||||
"""Get dict of CXXFLAGS, LINKFLAGS, and DEFINES that are needed only in optimized mode"""
|
||||
return {'CXXFLAGS': [], 'LINKFLAGS': [], 'DEFINES': ['NDEBUG']}
|
||||
|
||||
class GccBasicFlags(CompilerFlags):
|
||||
|
||||
class GccClangCommonFlags(CompilerFlags):
|
||||
"""
|
||||
This class defines basic flags that work for both gcc and clang compilers
|
||||
This class defines common flags that work for both gcc and clang compilers.
|
||||
"""
|
||||
|
||||
def getGeneralFlags(self, conf):
|
||||
flags = super(GccBasicFlags, self).getGeneralFlags(conf)
|
||||
flags = super().getGeneralFlags(conf)
|
||||
flags['CXXFLAGS'] += ['-std=c++17']
|
||||
if Utils.unversioned_sys_platform() != 'darwin':
|
||||
flags['LINKFLAGS'] += ['-fuse-ld=lld']
|
||||
return flags
|
||||
|
||||
__cxxFlags = [
|
||||
'-fdiagnostics-color',
|
||||
'-Wall',
|
||||
'-Wextra',
|
||||
'-Wpedantic',
|
||||
'-Wenum-conversion',
|
||||
'-Wextra-semi',
|
||||
'-Wnon-virtual-dtor',
|
||||
'-Wno-unused-parameter',
|
||||
]
|
||||
__linkFlags = ['-Wl,-O1']
|
||||
|
||||
def getDebugFlags(self, conf):
|
||||
flags = super(GccBasicFlags, self).getDebugFlags(conf)
|
||||
flags['CXXFLAGS'] += ['-Og',
|
||||
'-g3',
|
||||
'-Wall',
|
||||
'-Wextra',
|
||||
'-Wpedantic',
|
||||
'-Werror',
|
||||
'-Wcatch-value=2',
|
||||
'-Wextra-semi',
|
||||
'-Wnon-virtual-dtor',
|
||||
'-Wno-error=deprecated-declarations', # Bug #3795
|
||||
'-Wno-error=maybe-uninitialized', # Bug #1615
|
||||
'-Wno-unused-parameter',
|
||||
]
|
||||
flags['LINKFLAGS'] += ['-Wl,-O1']
|
||||
flags = super().getDebugFlags(conf)
|
||||
flags['CXXFLAGS'] += ['-Og', '-g'] + self.__cxxFlags + [
|
||||
'-Werror',
|
||||
'-Wno-error=deprecated-declarations', # Bug #3795
|
||||
'-Wno-error=maybe-uninitialized', # Bug #1615
|
||||
]
|
||||
flags['LINKFLAGS'] += self.__linkFlags
|
||||
return flags
|
||||
|
||||
def getOptimizedFlags(self, conf):
|
||||
flags = super(GccBasicFlags, self).getOptimizedFlags(conf)
|
||||
flags['CXXFLAGS'] += ['-O2',
|
||||
'-g',
|
||||
'-Wall',
|
||||
'-Wextra',
|
||||
'-Wpedantic',
|
||||
'-Wcatch-value=2',
|
||||
'-Wextra-semi',
|
||||
'-Wnon-virtual-dtor',
|
||||
'-Wno-unused-parameter',
|
||||
]
|
||||
flags['LINKFLAGS'] += ['-Wl,-O1']
|
||||
flags = super().getOptimizedFlags(conf)
|
||||
flags['CXXFLAGS'] += ['-O2', '-g1'] + self.__cxxFlags
|
||||
flags['LINKFLAGS'] += self.__linkFlags
|
||||
return flags
|
||||
|
||||
class GccFlags(GccBasicFlags):
|
||||
|
||||
class GccFlags(GccClangCommonFlags):
|
||||
__cxxFlags = [
|
||||
'-Wcatch-value=2',
|
||||
'-Wcomma-subscript', # enabled by default in C++20
|
||||
'-Wduplicated-branches',
|
||||
'-Wduplicated-cond',
|
||||
'-Wlogical-op',
|
||||
'-Wredundant-tags',
|
||||
'-Wvolatile', # enabled by default in C++20
|
||||
]
|
||||
|
||||
def getDebugFlags(self, conf):
|
||||
flags = super(GccFlags, self).getDebugFlags(conf)
|
||||
flags['CXXFLAGS'] += ['-fdiagnostics-color',
|
||||
'-Wredundant-tags',
|
||||
]
|
||||
flags = super().getDebugFlags(conf)
|
||||
flags['CXXFLAGS'] += self.__cxxFlags
|
||||
if platform.machine() == 'armv7l':
|
||||
flags['CXXFLAGS'] += ['-Wno-psabi'] # Bug #5106
|
||||
return flags
|
||||
|
||||
def getOptimizedFlags(self, conf):
|
||||
flags = super(GccFlags, self).getOptimizedFlags(conf)
|
||||
flags['CXXFLAGS'] += ['-fdiagnostics-color',
|
||||
'-Wredundant-tags',
|
||||
]
|
||||
flags = super().getOptimizedFlags(conf)
|
||||
flags['CXXFLAGS'] += self.__cxxFlags
|
||||
if platform.machine() == 'armv7l':
|
||||
flags['CXXFLAGS'] += ['-Wno-psabi'] # Bug #5106
|
||||
return flags
|
||||
|
||||
class ClangFlags(GccBasicFlags):
|
||||
|
||||
class ClangFlags(GccClangCommonFlags):
|
||||
def getGeneralFlags(self, conf):
|
||||
flags = super(ClangFlags, self).getGeneralFlags(conf)
|
||||
flags = super().getGeneralFlags(conf)
|
||||
if Utils.unversioned_sys_platform() == 'darwin':
|
||||
# Bug #4296
|
||||
brewdir = '/opt/homebrew' if platform.machine() == 'arm64' else '/usr/local'
|
||||
flags['CXXFLAGS'] += [['-isystem', f'{brewdir}/include'], # for Homebrew
|
||||
['-isystem', '/opt/local/include']] # for MacPorts
|
||||
flags['CXXFLAGS'] += [
|
||||
['-isystem', f'{brewdir}/include'], # for Homebrew
|
||||
['-isystem', '/opt/local/include'], # for MacPorts
|
||||
]
|
||||
elif Utils.unversioned_sys_platform() == 'freebsd':
|
||||
# Bug #4790
|
||||
flags['CXXFLAGS'] += [['-isystem', '/usr/local/include']]
|
||||
return flags
|
||||
|
||||
__cxxFlags = [
|
||||
'-Wundefined-func-template',
|
||||
'-Wno-unused-local-typedef', # Bugs #2657 and #3209
|
||||
]
|
||||
|
||||
def getDebugFlags(self, conf):
|
||||
flags = super(ClangFlags, self).getDebugFlags(conf)
|
||||
flags['CXXFLAGS'] += ['-fcolor-diagnostics',
|
||||
'-Wundefined-func-template',
|
||||
'-Wno-unused-local-typedef', # Bugs #2657 and #3209
|
||||
]
|
||||
flags = super().getDebugFlags(conf)
|
||||
flags['CXXFLAGS'] += self.__cxxFlags
|
||||
return flags
|
||||
|
||||
def getOptimizedFlags(self, conf):
|
||||
flags = super(ClangFlags, self).getOptimizedFlags(conf)
|
||||
flags['CXXFLAGS'] += ['-fcolor-diagnostics',
|
||||
'-Wundefined-func-template',
|
||||
'-Wno-unused-local-typedef', # Bugs #2657 and #3209
|
||||
]
|
||||
flags = super().getOptimizedFlags(conf)
|
||||
flags['CXXFLAGS'] += self.__cxxFlags
|
||||
return flags
|
||||
|
||||
+1
-1
@@ -2,7 +2,7 @@
|
||||
|
||||
The following lists maintainers, primary developers, and all much-appreciated contributors to PSync in alphabetical order.
|
||||
The specific contributions of individual authors can be obtained from the git history of the [official PSync repository](https://github.com/named-data/PSync).
|
||||
If you would like to become a contributor to the official repository, please follow the recommendations in <https://github.com/named-data/.github/blob/master/CONTRIBUTING.md>.
|
||||
If you would like to become a contributor to the official repository, please follow the recommendations in <https://github.com/named-data/.github/blob/main/CONTRIBUTING.md>.
|
||||
|
||||
* Alexander Afanasyev <https://users.cs.fiu.edu/~afanasyev>
|
||||
* ***(Maintainer)*** Saurab Dulal <https://dulalsaurab.github.io>
|
||||
|
||||
+23
-17
@@ -1,6 +1,6 @@
|
||||
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
|
||||
/*
|
||||
* Copyright (c) 2014-2022, The University of Memphis
|
||||
* Copyright (c) 2014-2023, The University of Memphis
|
||||
*
|
||||
* This file is part of PSync.
|
||||
* See AUTHORS.md for complete list of PSync authors and contributors.
|
||||
@@ -27,27 +27,33 @@ namespace psync {
|
||||
|
||||
NDN_LOG_INIT(psync.Consumer);
|
||||
|
||||
Consumer::Consumer(ndn::Face& face, const ndn::Name& syncPrefix, const Options& opts)
|
||||
: m_face(face)
|
||||
, m_scheduler(m_face.getIoContext())
|
||||
, m_syncPrefix(syncPrefix)
|
||||
, m_helloInterestPrefix(ndn::Name(m_syncPrefix).append("hello"))
|
||||
, m_syncInterestPrefix(ndn::Name(m_syncPrefix).append("sync"))
|
||||
, m_syncDataContentType(ndn::tlv::ContentType_Blob)
|
||||
, m_onReceiveHelloData(opts.onHelloData)
|
||||
, m_onUpdate(opts.onUpdate)
|
||||
, m_bloomFilter(opts.bfCount, opts.bfFalsePositive)
|
||||
, m_helloInterestLifetime(opts.helloInterestLifetime)
|
||||
, m_syncInterestLifetime(opts.syncInterestLifetime)
|
||||
, m_rng(ndn::random::getRandomNumberEngine())
|
||||
, m_rangeUniformRandom(100, 500)
|
||||
{
|
||||
}
|
||||
|
||||
Consumer::Consumer(const ndn::Name& syncPrefix,
|
||||
ndn::Face& face,
|
||||
const ReceiveHelloCallback& onReceiveHelloData,
|
||||
const UpdateCallback& onUpdate,
|
||||
unsigned int count,
|
||||
double false_positive = 0.001,
|
||||
double falsePositive,
|
||||
ndn::time::milliseconds helloInterestLifetime,
|
||||
ndn::time::milliseconds syncInterestLifetime)
|
||||
: m_face(face)
|
||||
, m_scheduler(m_face.getIoService())
|
||||
, m_syncPrefix(syncPrefix)
|
||||
, m_helloInterestPrefix(ndn::Name(m_syncPrefix).append("hello"))
|
||||
, m_syncInterestPrefix(ndn::Name(m_syncPrefix).append("sync"))
|
||||
, m_syncDataContentType(ndn::tlv::ContentType_Blob)
|
||||
, m_onReceiveHelloData(onReceiveHelloData)
|
||||
, m_onUpdate(onUpdate)
|
||||
, m_bloomFilter(count, false_positive)
|
||||
, m_helloInterestLifetime(helloInterestLifetime)
|
||||
, m_syncInterestLifetime(syncInterestLifetime)
|
||||
, m_rng(ndn::random::getRandomNumberEngine())
|
||||
, m_rangeUniformRandom(100, 500)
|
||||
: Consumer(face, syncPrefix,
|
||||
Options{onReceiveHelloData, onUpdate, count, falsePositive, helloInterestLifetime, syncInterestLifetime})
|
||||
{
|
||||
}
|
||||
|
||||
@@ -118,7 +124,7 @@ Consumer::sendHelloInterest()
|
||||
m_helloFetcher->stop();
|
||||
}
|
||||
|
||||
using ndn::util::SegmentFetcher;
|
||||
using ndn::SegmentFetcher;
|
||||
SegmentFetcher::Options options;
|
||||
options.interestLifetime = m_helloInterestLifetime;
|
||||
options.maxTimeout = m_helloInterestLifetime;
|
||||
@@ -204,7 +210,7 @@ Consumer::sendSyncInterest()
|
||||
m_syncFetcher->stop();
|
||||
}
|
||||
|
||||
using ndn::util::SegmentFetcher;
|
||||
using ndn::SegmentFetcher;
|
||||
SegmentFetcher::Options options;
|
||||
options.interestLifetime = m_syncInterestLifetime;
|
||||
options.maxTimeout = m_syncInterestLifetime;
|
||||
|
||||
+31
-14
@@ -1,6 +1,6 @@
|
||||
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
|
||||
/*
|
||||
* Copyright (c) 2014-2022, The University of Memphis
|
||||
* Copyright (c) 2014-2023, The University of Memphis
|
||||
*
|
||||
* This file is part of PSync.
|
||||
* See AUTHORS.md for complete list of PSync authors and contributors.
|
||||
@@ -56,23 +56,40 @@ class Consumer
|
||||
{
|
||||
public:
|
||||
/**
|
||||
* @brief constructor
|
||||
*
|
||||
* @param syncPrefix syncPrefix to send hello/sync interests to producer
|
||||
* @param face application's face
|
||||
* @param onReceiveHelloData call back to give hello data back to application
|
||||
* @param onUpdate call back to give sync data back to application
|
||||
* @param count bloom filter number of expected elements (subscriptions) in bloom filter
|
||||
* @param false_positive bloom filter false positive probability
|
||||
* @param helloInterestLifetime lifetime of hello interest
|
||||
* @param syncInterestLifetime lifetime of sync interest
|
||||
* @brief Constructor options.
|
||||
*/
|
||||
struct Options
|
||||
{
|
||||
/// Callback to give hello data back to application.
|
||||
ReceiveHelloCallback onHelloData = [] (const auto&) {};
|
||||
/// Callback to give sync data back to application.
|
||||
UpdateCallback onUpdate = [] (const auto&) {};
|
||||
/// Number of expected elements (subscriptions) in Bloom filter.
|
||||
unsigned int bfCount = 80;
|
||||
/// Bloom filter false positive probability.
|
||||
double bfFalsePositive = 0.001;
|
||||
/// Lifetime of hello Interest.
|
||||
ndn::time::milliseconds helloInterestLifetime = HELLO_INTEREST_LIFETIME;
|
||||
/// Lifetime of sync Interest.
|
||||
ndn::time::milliseconds syncInterestLifetime = SYNC_INTEREST_LIFETIME;
|
||||
};
|
||||
|
||||
/**
|
||||
* @brief Constructor.
|
||||
*
|
||||
* @param face Application face.
|
||||
* @param syncPrefix Prefix to send hello and sync Interests to producer.
|
||||
* @param opts Options.
|
||||
*/
|
||||
Consumer(ndn::Face& face, const ndn::Name& syncPrefix, const Options& opts);
|
||||
|
||||
[[deprecated]]
|
||||
Consumer(const ndn::Name& syncPrefix,
|
||||
ndn::Face& face,
|
||||
const ReceiveHelloCallback& onReceiveHelloData,
|
||||
const UpdateCallback& onUpdate,
|
||||
unsigned int count,
|
||||
double false_positive,
|
||||
double falsePositive = 0.001,
|
||||
ndn::time::milliseconds helloInterestLifetime = HELLO_INTEREST_LIFETIME,
|
||||
ndn::time::milliseconds syncInterestLifetime = SYNC_INTEREST_LIFETIME);
|
||||
|
||||
@@ -202,8 +219,8 @@ PSYNC_PUBLIC_WITH_TESTS_ELSE_PRIVATE:
|
||||
|
||||
ndn::random::RandomNumberEngine& m_rng;
|
||||
std::uniform_int_distribution<> m_rangeUniformRandom;
|
||||
std::shared_ptr<ndn::util::SegmentFetcher> m_helloFetcher;
|
||||
std::shared_ptr<ndn::util::SegmentFetcher> m_syncFetcher;
|
||||
std::shared_ptr<ndn::SegmentFetcher> m_helloFetcher;
|
||||
std::shared_ptr<ndn::SegmentFetcher> m_syncFetcher;
|
||||
};
|
||||
|
||||
} // namespace psync
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
|
||||
/*
|
||||
* Copyright (c) 2014-2022, The University of Memphis
|
||||
* Copyright (c) 2014-2023, The University of Memphis
|
||||
*
|
||||
* This file is part of PSync.
|
||||
* See AUTHORS.md for complete list of PSync authors and contributors.
|
||||
@@ -100,7 +100,7 @@ FullProducer::sendSyncInterest()
|
||||
|
||||
ndn::Interest syncInterest(syncInterestName);
|
||||
|
||||
using ndn::util::SegmentFetcher;
|
||||
using ndn::SegmentFetcher;
|
||||
SegmentFetcher::Options options;
|
||||
options.interestLifetime = m_syncInterestLifetime;
|
||||
options.maxTimeout = m_syncInterestLifetime;
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
|
||||
/*
|
||||
* Copyright (c) 2014-2022, The University of Memphis
|
||||
* Copyright (c) 2014-2023, The University of Memphis
|
||||
*
|
||||
* This file is part of PSync.
|
||||
* See AUTHORS.md for complete list of PSync authors and contributors.
|
||||
@@ -189,7 +189,7 @@ private:
|
||||
std::uniform_int_distribution<> m_jitter{100, 500};
|
||||
ndn::Name m_outstandingInterestName;
|
||||
ndn::ScopedRegisteredPrefixHandle m_registeredPrefix;
|
||||
std::shared_ptr<ndn::util::SegmentFetcher> m_fetcher;
|
||||
std::shared_ptr<ndn::SegmentFetcher> m_fetcher;
|
||||
uint64_t m_incomingFace = 0;
|
||||
};
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
|
||||
/*
|
||||
* Copyright (c) 2014-2022, The University of Memphis
|
||||
* Copyright (c) 2014-2023, The University of Memphis
|
||||
*
|
||||
* This file is part of PSync.
|
||||
* See AUTHORS.md for complete list of PSync authors and contributors.
|
||||
@@ -37,7 +37,7 @@ ProducerBase::ProducerBase(ndn::Face& face,
|
||||
CompressionScheme contentCompression)
|
||||
: m_face(face)
|
||||
, m_keyChain(keyChain)
|
||||
, m_scheduler(m_face.getIoService())
|
||||
, m_scheduler(m_face.getIoContext())
|
||||
, m_rng(ndn::random::getRandomNumberEngine())
|
||||
, m_iblt(expectedNumEntries, ibltCompression)
|
||||
, m_segmentPublisher(m_face, m_keyChain)
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
|
||||
/*
|
||||
* Copyright (c) 2014-2022, The University of Memphis
|
||||
* Copyright (c) 2014-2023, The University of Memphis
|
||||
*
|
||||
* This file is part of PSync.
|
||||
* See AUTHORS.md for complete list of PSync authors and contributors.
|
||||
@@ -24,7 +24,7 @@ namespace psync {
|
||||
SegmentPublisher::SegmentPublisher(ndn::Face& face, ndn::KeyChain& keyChain,
|
||||
const ndn::security::SigningInfo& signingInfo, size_t imsLimit)
|
||||
: m_face(face)
|
||||
, m_scheduler(m_face.getIoService())
|
||||
, m_scheduler(m_face.getIoContext())
|
||||
, m_segmenter(keyChain, signingInfo)
|
||||
, m_ims(imsLimit)
|
||||
{
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
|
||||
/*
|
||||
* Copyright (c) 2014-2022, The University of Memphis
|
||||
* Copyright (c) 2014-2023, The University of Memphis
|
||||
*
|
||||
* This file is part of PSync.
|
||||
* See AUTHORS.md for complete list of PSync authors and contributors.
|
||||
@@ -62,7 +62,7 @@ public:
|
||||
private:
|
||||
ndn::Face& m_face;
|
||||
ndn::Scheduler m_scheduler;
|
||||
ndn::util::Segmenter m_segmenter;
|
||||
ndn::Segmenter m_segmenter;
|
||||
|
||||
PSYNC_PUBLIC_WITH_TESTS_ELSE_PRIVATE:
|
||||
ndn::InMemoryStorageFifo m_ims;
|
||||
|
||||
@@ -19,7 +19,7 @@ PSync uses the [ndn-cxx](https://github.com/named-data/ndn-cxx) library.
|
||||
|
||||
### Prerequisites
|
||||
|
||||
* [ndn-cxx and its dependencies](https://named-data.net/doc/ndn-cxx/current/INSTALL.html)
|
||||
* [ndn-cxx and its dependencies](https://docs.named-data.net/ndn-cxx/current/INSTALL.html)
|
||||
|
||||
### Build
|
||||
|
||||
@@ -29,11 +29,11 @@ To build PSync from source:
|
||||
./waf
|
||||
sudo ./waf install
|
||||
|
||||
To build on memory constrained platform, please use `./waf -j1` instead of `./waf`. The
|
||||
command will disable parallel compilation.
|
||||
To build on memory constrained systems, please use `./waf -j1` instead of `./waf`. This
|
||||
will disable parallel compilation.
|
||||
|
||||
If configured with tests (`./waf configure --with-tests`), the above commands will also
|
||||
generate unit tests that can be run with `./build/unit-tests`.
|
||||
build a suite of unit tests that can be run with `./build/unit-tests`.
|
||||
|
||||
## Reporting bugs
|
||||
|
||||
@@ -42,10 +42,10 @@ Please submit any bug reports or feature requests to the
|
||||
|
||||
## Contributing
|
||||
|
||||
We greatly appreciate contributions to the PSync code base, provided that they are
|
||||
licensed under the GNU LGPL version 3 or a compatible license.
|
||||
Contributions to PSync are greatly appreciated and can be made through our
|
||||
[Gerrit code review site](https://gerrit.named-data.net/).
|
||||
If you are new to the NDN software community, please read our [Contributor's Guide](
|
||||
https://github.com/named-data/.github/blob/master/CONTRIBUTING.md) to get started.
|
||||
https://github.com/named-data/.github/blob/main/CONTRIBUTING.md) to get started.
|
||||
|
||||
## License
|
||||
|
||||
|
||||
@@ -437,7 +437,7 @@ EXTRACT_PACKAGE = NO
|
||||
# included in the documentation.
|
||||
# The default value is: NO.
|
||||
|
||||
EXTRACT_STATIC = YES
|
||||
EXTRACT_STATIC = NO
|
||||
|
||||
# If the EXTRACT_LOCAL_CLASSES tag is set to YES, classes (and structs) defined
|
||||
# locally in source files will be included in the documentation. If set to NO,
|
||||
@@ -1178,7 +1178,7 @@ HTML_COLORSTYLE_GAMMA = 91
|
||||
# The default value is: NO.
|
||||
# This tag requires that the tag GENERATE_HTML is set to YES.
|
||||
|
||||
HTML_TIMESTAMP = YES
|
||||
HTML_TIMESTAMP = NO
|
||||
|
||||
# If the HTML_DYNAMIC_SECTIONS tag is set to YES then the generated HTML
|
||||
# documentation will contain sections that can be hidden and shown after the
|
||||
|
||||
+16
-6
@@ -28,14 +28,24 @@ Documentation
|
||||
- :doc:`release-notes`
|
||||
- :doc:`releases`
|
||||
|
||||
Issues
|
||||
------
|
||||
|
||||
Please submit any bug reports or feature requests to the
|
||||
`PSync issue tracker <https://redmine.named-data.net/projects/psync/issues>`__.
|
||||
|
||||
Contributing
|
||||
------------
|
||||
|
||||
We greatly appreciate contributions to the PSync code base, provided that they are
|
||||
licensed under the GNU LGPL version 3 or a compatible license (see `COPYING.md
|
||||
<https://github.com/named-data/PSync/blob/master/COPYING.md>`__ for more information).
|
||||
Contributions to PSync are greatly appreciated and can be made through our
|
||||
`Gerrit code review site <https://gerrit.named-data.net/>`__.
|
||||
If you are new to the NDN software community, please read our `Contributor's Guide
|
||||
<https://github.com/named-data/.github/blob/master/CONTRIBUTING.md>`__ to get started.
|
||||
<https://github.com/named-data/.github/blob/main/CONTRIBUTING.md>`__ to get started.
|
||||
|
||||
Please submit any bug reports or feature requests to the `PSync issue tracker
|
||||
<https://redmine.named-data.net/projects/psync/issues>`__.
|
||||
License
|
||||
-------
|
||||
|
||||
PSync is free software: you can redistribute it and/or modify it under the terms of
|
||||
the GNU Lesser General Public License as published by the Free Software Foundation,
|
||||
either version 3 of the License, or (at your option) any later version. See `COPYING.md
|
||||
<https://github.com/named-data/PSync/blob/master/COPYING.md>`__ for details.
|
||||
|
||||
+1
-1
@@ -4,7 +4,7 @@ Installation Instructions
|
||||
Prerequisites
|
||||
-------------
|
||||
|
||||
- `ndn-cxx <https://named-data.net/doc/ndn-cxx>`_ and its dependencies
|
||||
- `ndn-cxx <https://docs.named-data.net/ndn-cxx/>`__ and its dependencies
|
||||
|
||||
Build
|
||||
-----
|
||||
|
||||
@@ -32,7 +32,7 @@ $mathjax
|
||||
|
||||
<!--top menu-->
|
||||
<div class="nine columns" id="menu_container" >
|
||||
<h1><a href="https://named-data.net/doc/PSync/$projectnumber/">$projectname $projectnumber documentation</a></h1>
|
||||
<h1><a href="https://docs.named-data.net/PSync/$projectnumber/">$projectname $projectnumber documentation</a></h1>
|
||||
</div>
|
||||
</div>
|
||||
</div><!--header container end-->
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
|
||||
/*
|
||||
* Copyright (c) 2014-2022, The University of Memphis
|
||||
* Copyright (c) 2014-2023, The University of Memphis
|
||||
*
|
||||
* This file is part of PSync.
|
||||
* See AUTHORS.md for complete list of PSync authors and contributors.
|
||||
@@ -32,18 +32,18 @@ class PSyncConsumer
|
||||
public:
|
||||
/**
|
||||
* @brief Initialize consumer and start hello process
|
||||
*
|
||||
* 0.001 is the false positive probability of the bloom filter
|
||||
*
|
||||
* @param syncPrefix should be the same as producer
|
||||
* @param nSub number of subscriptions is used for the bloom filter (subscription list) size
|
||||
*/
|
||||
PSyncConsumer(const ndn::Name& syncPrefix, int nSub)
|
||||
: m_nSub(nSub)
|
||||
, m_consumer(syncPrefix, m_face,
|
||||
std::bind(&PSyncConsumer::afterReceiveHelloData, this, _1),
|
||||
std::bind(&PSyncConsumer::processSyncUpdate, this, _1),
|
||||
m_nSub, 0.001)
|
||||
, m_consumer(m_face, syncPrefix, [this] {
|
||||
psync::Consumer::Options opts;
|
||||
opts.onHelloData = std::bind(&PSyncConsumer::afterReceiveHelloData, this, _1);
|
||||
opts.onUpdate = std::bind(&PSyncConsumer::processSyncUpdate, this, _1);
|
||||
opts.bfCount = m_nSub;
|
||||
return opts;
|
||||
} ())
|
||||
{
|
||||
// This starts the consumer side by sending a hello interest to the producer
|
||||
// When the producer responds with hello data, afterReceiveHelloData is called
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
|
||||
/*
|
||||
* Copyright (c) 2014-2022, The University of Memphis
|
||||
* Copyright (c) 2014-2023, The University of Memphis
|
||||
*
|
||||
* This file is part of PSync.
|
||||
* See AUTHORS.md for complete list of PSync authors and contributors.
|
||||
@@ -91,7 +91,7 @@ private:
|
||||
private:
|
||||
ndn::Face m_face;
|
||||
ndn::KeyChain m_keyChain;
|
||||
ndn::Scheduler m_scheduler{m_face.getIoService()};
|
||||
ndn::Scheduler m_scheduler{m_face.getIoContext()};
|
||||
|
||||
psync::FullProducer m_producer;
|
||||
uint64_t m_maxNumPublish;
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
|
||||
/*
|
||||
* Copyright (c) 2014-2022, The University of Memphis
|
||||
* Copyright (c) 2014-2023, The University of Memphis
|
||||
*
|
||||
* This file is part of PSync.
|
||||
* See AUTHORS.md for complete list of PSync authors and contributors.
|
||||
@@ -82,7 +82,7 @@ private:
|
||||
private:
|
||||
ndn::Face m_face;
|
||||
ndn::KeyChain m_keyChain;
|
||||
ndn::Scheduler m_scheduler{m_face.getIoService()};
|
||||
ndn::Scheduler m_scheduler{m_face.getIoContext()};
|
||||
|
||||
psync::PartialProducer m_producer;
|
||||
uint64_t m_maxNumPublish;
|
||||
|
||||
+3
-3
@@ -6,7 +6,7 @@ def build(bld):
|
||||
# List all .cpp files (whole example in one .cpp)
|
||||
for ex in bld.path.ant_glob('*.cpp'):
|
||||
name = ex.change_ext('').path_from(bld.path.get_bld())
|
||||
bld.program(name='example-%s' % name,
|
||||
target='psync-%s' % name,
|
||||
bld.program(name=f'example-{name}',
|
||||
target=f'psync-{name}',
|
||||
source=[ex],
|
||||
use='PSync')
|
||||
use='PSync')
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil -*- */
|
||||
/*
|
||||
* Copyright (c) 2013-2022 Regents of the University of California
|
||||
* The University of Memphis
|
||||
* Copyright (c) 2013-2023, Regents of the University of California,
|
||||
* The University of Memphis.
|
||||
*
|
||||
* This file is part of PSync.
|
||||
*
|
||||
@@ -22,7 +22,7 @@
|
||||
|
||||
#include "tests/clock-fixture.hpp"
|
||||
|
||||
#include <boost/asio/io_service.hpp>
|
||||
#include <boost/asio/io_context.hpp>
|
||||
|
||||
namespace psync::tests {
|
||||
|
||||
@@ -33,17 +33,13 @@ private:
|
||||
afterTick() final
|
||||
{
|
||||
if (m_io.stopped()) {
|
||||
#if BOOST_VERSION >= 106600
|
||||
m_io.restart();
|
||||
#else
|
||||
m_io.reset();
|
||||
#endif
|
||||
}
|
||||
m_io.poll();
|
||||
}
|
||||
|
||||
protected:
|
||||
boost::asio::io_service m_io;
|
||||
boost::asio::io_context m_io;
|
||||
};
|
||||
|
||||
} // namespace psync::tests
|
||||
|
||||
+16
-17
@@ -1,6 +1,6 @@
|
||||
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
|
||||
/*
|
||||
* Copyright (c) 2014-2022, The University of Memphis
|
||||
* Copyright (c) 2014-2023, The University of Memphis
|
||||
*
|
||||
* This file is part of PSync.
|
||||
* See AUTHORS.md for complete list of PSync authors and contributors.
|
||||
@@ -26,17 +26,16 @@
|
||||
|
||||
namespace psync {
|
||||
|
||||
using namespace ndn;
|
||||
using ndn::Name;
|
||||
|
||||
BOOST_AUTO_TEST_SUITE(TestConsumer)
|
||||
|
||||
BOOST_AUTO_TEST_CASE(AddSubscription)
|
||||
{
|
||||
util::DummyClientFace face;
|
||||
Consumer consumer(Name("/psync"), face,
|
||||
[] (const auto&) {},
|
||||
[] (const auto&) {},
|
||||
40, 0.001);
|
||||
ndn::DummyClientFace face;
|
||||
Consumer::Options opts;
|
||||
opts.bfCount = 40;
|
||||
Consumer consumer(face, "/psync", opts);
|
||||
|
||||
Name subscription("test");
|
||||
|
||||
@@ -47,11 +46,10 @@ BOOST_AUTO_TEST_CASE(AddSubscription)
|
||||
|
||||
BOOST_AUTO_TEST_CASE(RemoveSubscription)
|
||||
{
|
||||
util::DummyClientFace face;
|
||||
Consumer consumer(Name("/psync"), face,
|
||||
[] (const auto&) {},
|
||||
[] (const auto&) {},
|
||||
40, 0.001);
|
||||
ndn::DummyClientFace face;
|
||||
Consumer::Options opts;
|
||||
opts.bfCount = 40;
|
||||
Consumer consumer(face, "/psync", opts);
|
||||
|
||||
Name subscription("test");
|
||||
consumer.addSubscription(subscription, 0);
|
||||
@@ -64,11 +62,12 @@ BOOST_AUTO_TEST_CASE(RemoveSubscription)
|
||||
|
||||
BOOST_FIXTURE_TEST_CASE(ConstantTimeoutForFirstSegment, tests::IoFixture)
|
||||
{
|
||||
util::DummyClientFace face(m_io);
|
||||
Consumer consumer(Name("/psync"), face,
|
||||
[] (const auto&) {},
|
||||
[] (const auto&) {},
|
||||
40, 0.001, 4_s, 4_s);
|
||||
ndn::DummyClientFace face(m_io);
|
||||
Consumer::Options opts;
|
||||
opts.bfCount = 40;
|
||||
opts.helloInterestLifetime = 4_s;
|
||||
opts.syncInterestLifetime = 4_s;
|
||||
Consumer consumer(face, "/psync", opts);
|
||||
|
||||
consumer.sendHelloInterest();
|
||||
advanceClocks(4_s);
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
|
||||
/*
|
||||
* Copyright (c) 2014-2022, The University of Memphis
|
||||
* Copyright (c) 2014-2023, The University of Memphis
|
||||
*
|
||||
* This file is part of PSync.
|
||||
* See AUTHORS.md for complete list of PSync authors and contributors.
|
||||
@@ -28,12 +28,13 @@
|
||||
|
||||
namespace psync {
|
||||
|
||||
using namespace ndn;
|
||||
using ndn::Interest;
|
||||
using ndn::Name;
|
||||
|
||||
class FullProducerFixture : public tests::IoFixture, public tests::KeyChainFixture
|
||||
{
|
||||
protected:
|
||||
util::DummyClientFace m_face{m_io, m_keyChain, {true, true}};
|
||||
ndn::DummyClientFace m_face{m_io, m_keyChain, {true, true}};
|
||||
};
|
||||
|
||||
BOOST_FIXTURE_TEST_SUITE(TestFullProducer, FullProducerFixture)
|
||||
@@ -71,7 +72,7 @@ BOOST_AUTO_TEST_CASE(OnSyncDataDecodeFailure)
|
||||
node.m_iblt.appendToName(syncInterestName);
|
||||
Interest syncInterest(syncInterestName);
|
||||
|
||||
auto badCompress = std::make_shared<const Buffer>(5);
|
||||
auto badCompress = std::make_shared<const ndn::Buffer>(5);
|
||||
BOOST_CHECK_NO_THROW(node.onSyncData(syncInterest, badCompress));
|
||||
|
||||
const uint8_t test[] = {'t', 'e', 's', 't'};
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
|
||||
/*
|
||||
* Copyright (c) 2014-2022, The University of Memphis
|
||||
* Copyright (c) 2014-2023, The University of Memphis
|
||||
*
|
||||
* This file is part of PSync.
|
||||
* See AUTHORS.md for complete list of PSync authors and contributors.
|
||||
@@ -31,7 +31,8 @@
|
||||
|
||||
namespace psync {
|
||||
|
||||
using namespace ndn;
|
||||
using ndn::Interest;
|
||||
using ndn::Name;
|
||||
|
||||
class FullSyncFixture : public tests::IoFixture, public tests::KeyChainFixture
|
||||
{
|
||||
@@ -41,8 +42,8 @@ protected:
|
||||
{
|
||||
BOOST_ASSERT(id >= 0 && id < MAX_NODES);
|
||||
userPrefixes[id] = "/userPrefix" + std::to_string(id);
|
||||
faces[id] = std::make_unique<util::DummyClientFace>(m_io, m_keyChain,
|
||||
util::DummyClientFace::Options{true, true});
|
||||
faces[id] = std::make_unique<ndn::DummyClientFace>(m_io, m_keyChain,
|
||||
ndn::DummyClientFace::Options{true, true});
|
||||
nodes[id] = std::make_unique<FullProducer>(*faces[id], m_keyChain, 40, syncPrefix, userPrefixes[id],
|
||||
[] (const auto&) {});
|
||||
}
|
||||
@@ -174,7 +175,7 @@ protected:
|
||||
const Name syncPrefix = "/psync";
|
||||
static constexpr int MAX_NODES = 4;
|
||||
std::array<Name, MAX_NODES> userPrefixes;
|
||||
std::array<std::unique_ptr<util::DummyClientFace>, MAX_NODES> faces;
|
||||
std::array<std::unique_ptr<ndn::DummyClientFace>, MAX_NODES> faces;
|
||||
std::array<std::unique_ptr<FullProducer>, MAX_NODES> nodes;
|
||||
static constexpr uint64_t NOT_EXIST = std::numeric_limits<uint64_t>::max();
|
||||
};
|
||||
@@ -467,7 +468,7 @@ BOOST_AUTO_TEST_CASE(DelayedSecondSegment)
|
||||
|
||||
int i = 0;
|
||||
detail::State state;
|
||||
std::shared_ptr<Buffer> compressed;
|
||||
std::shared_ptr<ndn::Buffer> compressed;
|
||||
do {
|
||||
auto prefixToPublish = makeSubPrefix(0, i++);
|
||||
nodes[0]->addUserNode(prefixToPublish);
|
||||
@@ -477,7 +478,7 @@ BOOST_AUTO_TEST_CASE(DelayedSecondSegment)
|
||||
|
||||
auto block = state.wireEncode();
|
||||
compressed = detail::compress(nodes[0]->m_contentCompression, block);
|
||||
} while (compressed->size() < (MAX_NDN_PACKET_SIZE >> 1));
|
||||
} while (compressed->size() < (ndn::MAX_NDN_PACKET_SIZE >> 1));
|
||||
|
||||
advanceClocks(10_ms, 100);
|
||||
|
||||
|
||||
+3
-3
@@ -1,6 +1,6 @@
|
||||
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
|
||||
/*
|
||||
* Copyright (c) 2014-2022, The University of Memphis
|
||||
* Copyright (c) 2014-2023, The University of Memphis
|
||||
*
|
||||
* This file is part of PSync.
|
||||
* See AUTHORS.md for complete list of PSync authors and contributors.
|
||||
@@ -25,7 +25,7 @@
|
||||
namespace psync {
|
||||
namespace detail {
|
||||
|
||||
using namespace ndn;
|
||||
using ndn::Name;
|
||||
|
||||
BOOST_AUTO_TEST_SUITE(TestIBLT)
|
||||
|
||||
@@ -96,7 +96,7 @@ BOOST_AUTO_TEST_CASE(NameAppendAndExtract)
|
||||
Name malformedName("/test");
|
||||
auto compressed = compress(CompressionScheme::DEFAULT,
|
||||
malformedName.wireEncode().value_bytes());
|
||||
malformedName.append(name::Component(std::move(compressed)));
|
||||
malformedName.append(Name::Component(std::move(compressed)));
|
||||
IBLT rcvd2(size, CompressionScheme::DEFAULT);
|
||||
BOOST_CHECK_THROW(rcvd2.initialize(malformedName.at(-1)), IBLT::Error);
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
|
||||
/*
|
||||
* Copyright (c) 2014-2022, The University of Memphis
|
||||
* Copyright (c) 2014-2023, The University of Memphis
|
||||
*
|
||||
* This file is part of PSync.
|
||||
* See AUTHORS.md for complete list of PSync authors and contributors.
|
||||
@@ -27,12 +27,13 @@
|
||||
|
||||
namespace psync {
|
||||
|
||||
using namespace ndn;
|
||||
using ndn::Interest;
|
||||
using ndn::Name;
|
||||
|
||||
class PartialProducerFixture : public tests::KeyChainFixture
|
||||
{
|
||||
protected:
|
||||
util::DummyClientFace m_face{m_keyChain, {true, true}};
|
||||
ndn::DummyClientFace m_face{m_keyChain, {true, true}};
|
||||
};
|
||||
|
||||
BOOST_FIXTURE_TEST_SUITE(TestPartialProducer, PartialProducerFixture)
|
||||
@@ -46,8 +47,8 @@ BOOST_AUTO_TEST_CASE(RegisterPrefix)
|
||||
|
||||
BOOST_REQUIRE_EQUAL(m_face.sentInterests.size(), 1);
|
||||
auto interest = m_face.sentInterests.front();
|
||||
BOOST_CHECK_EQUAL(interest.getName().at(3), name::Component("register"));
|
||||
nfd::ControlParameters params(interest.getName().at(4).blockFromValue());
|
||||
BOOST_CHECK_EQUAL(interest.getName().at(3), Name::Component("register"));
|
||||
ndn::nfd::ControlParameters params(interest.getName().at(4).blockFromValue());
|
||||
BOOST_CHECK_EQUAL(params.getName(), syncPrefix);
|
||||
}
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
|
||||
/*
|
||||
* Copyright (c) 2014-2022, The University of Memphis
|
||||
* Copyright (c) 2014-2023, The University of Memphis
|
||||
*
|
||||
* This file is part of PSync.
|
||||
* See AUTHORS.md for complete list of PSync authors and contributors.
|
||||
@@ -29,7 +29,8 @@
|
||||
|
||||
namespace psync {
|
||||
|
||||
using namespace ndn;
|
||||
using ndn::Interest;
|
||||
using ndn::Name;
|
||||
|
||||
class PartialSyncFixture : public tests::IoFixture, public tests::KeyChainFixture
|
||||
{
|
||||
@@ -52,8 +53,8 @@ protected:
|
||||
void
|
||||
addConsumer(int id, const std::vector<std::string>& subscribeTo, bool linkToProducer = true)
|
||||
{
|
||||
consumerFaces[id] = std::make_unique<util::DummyClientFace>(m_io, m_keyChain,
|
||||
util::DummyClientFace::Options{true, true});
|
||||
consumerFaces[id] = std::make_unique<ndn::DummyClientFace>(m_io, m_keyChain,
|
||||
ndn::DummyClientFace::Options{true, true});
|
||||
if (linkToProducer) {
|
||||
face.linkTo(*consumerFaces[id]);
|
||||
}
|
||||
@@ -132,7 +133,7 @@ protected:
|
||||
}
|
||||
|
||||
protected:
|
||||
util::DummyClientFace face{m_io, m_keyChain, {true, true}};
|
||||
ndn::DummyClientFace face{m_io, m_keyChain, {true, true}};
|
||||
const Name syncPrefix{"psync"};
|
||||
const Name userPrefix{"testUser-0"};
|
||||
|
||||
@@ -140,7 +141,7 @@ protected:
|
||||
std::map<Name, uint64_t> oldSeqMap;
|
||||
|
||||
std::array<std::unique_ptr<Consumer>, 3> consumers;
|
||||
std::array<std::unique_ptr<util::DummyClientFace>, 3> consumerFaces;
|
||||
std::array<std::unique_ptr<ndn::DummyClientFace>, 3> consumerFaces;
|
||||
int numHelloDataRcvd = 0;
|
||||
int numSyncDataRcvd = 0;
|
||||
};
|
||||
@@ -289,7 +290,7 @@ BOOST_AUTO_TEST_CASE(ReplicatedProducer)
|
||||
// Link to first producer goes down
|
||||
face.unlink();
|
||||
|
||||
util::DummyClientFace face2(m_io, m_keyChain, {true, true});
|
||||
ndn::DummyClientFace face2(m_io, m_keyChain, {true, true});
|
||||
PartialProducer replicatedProducer(face2, m_keyChain, 40, syncPrefix, userPrefix);
|
||||
for (int i = 1; i < 10; i++) {
|
||||
replicatedProducer.addUserNode("testUser-" + std::to_string(i));
|
||||
@@ -339,7 +340,7 @@ BOOST_AUTO_TEST_CASE(ApplicationNack)
|
||||
|
||||
bool nackRcvd = false;
|
||||
for (const auto& data : face.sentData) {
|
||||
if (data.getContentType() == tlv::ContentType_Nack) {
|
||||
if (data.getContentType() == ndn::tlv::ContentType_Nack) {
|
||||
nackRcvd = true;
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
|
||||
/*
|
||||
* Copyright (c) 2014-2022, The University of Memphis
|
||||
* Copyright (c) 2014-2023, The University of Memphis
|
||||
*
|
||||
* This file is part of PSync.
|
||||
* See AUTHORS.md for complete list of PSync authors and contributors.
|
||||
@@ -26,12 +26,12 @@
|
||||
|
||||
namespace psync {
|
||||
|
||||
using namespace ndn;
|
||||
using ndn::Name;
|
||||
|
||||
class ProducerBaseFixture : public tests::KeyChainFixture
|
||||
{
|
||||
protected:
|
||||
util::DummyClientFace m_face;
|
||||
ndn::DummyClientFace m_face;
|
||||
};
|
||||
|
||||
BOOST_FIXTURE_TEST_SUITE(TestProducerBase, ProducerBaseFixture)
|
||||
@@ -73,7 +73,7 @@ BOOST_AUTO_TEST_CASE(ApplicationNack)
|
||||
m_face.processEvents(10_ms);
|
||||
|
||||
BOOST_REQUIRE_EQUAL(m_face.sentData.size(), 1);
|
||||
BOOST_CHECK_EQUAL(m_face.sentData.front().getContentType(), tlv::ContentType_Nack);
|
||||
BOOST_CHECK_EQUAL(m_face.sentData.front().getContentType(), ndn::tlv::ContentType_Nack);
|
||||
}
|
||||
|
||||
BOOST_AUTO_TEST_SUITE_END()
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
|
||||
/*
|
||||
* Copyright (c) 2014-2022, The University of Memphis
|
||||
* Copyright (c) 2014-2023, The University of Memphis
|
||||
*
|
||||
* This file is part of PSync.
|
||||
* See AUTHORS.md for complete list of PSync authors and contributors.
|
||||
@@ -30,14 +30,16 @@
|
||||
|
||||
namespace psync {
|
||||
|
||||
using namespace ndn;
|
||||
using namespace ndn::time_literals;
|
||||
using ndn::Interest;
|
||||
using ndn::Name;
|
||||
|
||||
class SegmentPublisherFixture : public tests::IoFixture, public tests::KeyChainFixture
|
||||
{
|
||||
protected:
|
||||
SegmentPublisherFixture()
|
||||
{
|
||||
m_face.setInterestFilter(InterestFilter("/hello/world"),
|
||||
m_face.setInterestFilter(ndn::InterestFilter("/hello/world"),
|
||||
bind(&SegmentPublisherFixture::onInterest, this, _2),
|
||||
[] (auto&&...) { BOOST_CHECK(false); });
|
||||
advanceClocks(10_ms);
|
||||
@@ -55,7 +57,7 @@ protected:
|
||||
void
|
||||
expressInterest(const Interest& interest)
|
||||
{
|
||||
fetcher = util::SegmentFetcher::start(m_face, interest, security::getAcceptAllValidator());
|
||||
fetcher = ndn::SegmentFetcher::start(m_face, interest, ndn::security::getAcceptAllValidator());
|
||||
fetcher->onComplete.connect([this] (auto&&...) { numComplete++; });
|
||||
fetcher->onError.connect([] (auto&&...) { BOOST_CHECK(false); });
|
||||
|
||||
@@ -80,16 +82,16 @@ protected:
|
||||
}
|
||||
|
||||
protected:
|
||||
util::DummyClientFace m_face{m_io, m_keyChain, {true, true}};
|
||||
ndn::DummyClientFace m_face{m_io, m_keyChain, {true, true}};
|
||||
SegmentPublisher publisher{m_face, m_keyChain};
|
||||
std::shared_ptr<util::SegmentFetcher> fetcher;
|
||||
std::shared_ptr<ndn::SegmentFetcher> fetcher;
|
||||
Name dataName;
|
||||
detail::State state;
|
||||
|
||||
int numComplete = 0;
|
||||
int numRepliesFromStore = 0;
|
||||
|
||||
static constexpr time::milliseconds freshness = 1_s;
|
||||
static constexpr ndn::time::milliseconds freshness = 1_s;
|
||||
};
|
||||
|
||||
BOOST_FIXTURE_TEST_SUITE(TestSegmentPublisher, SegmentPublisherFixture)
|
||||
|
||||
+8
-5
@@ -1,8 +1,11 @@
|
||||
# -*- Mode: python; py-indent-offset: 4; indent-tabs-mode: nil; coding: utf-8; -*-
|
||||
|
||||
top = '..'
|
||||
|
||||
def build(bld):
|
||||
bld.program(target='../unit-tests',
|
||||
name='unit-tests',
|
||||
source=bld.path.ant_glob('**/*.cpp'),
|
||||
use='PSync',
|
||||
install_path=None)
|
||||
bld.program(
|
||||
target=f'{top}/unit-tests',
|
||||
name='unit-tests',
|
||||
source=bld.path.ant_glob('**/*.cpp'),
|
||||
use='BOOST_TESTS PSync',
|
||||
install_path=None)
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
# -*- Mode: python; py-indent-offset: 4; indent-tabs-mode: nil; coding: utf-8; -*-
|
||||
|
||||
from waflib import Context, Logs, Utils
|
||||
import os, subprocess
|
||||
import os
|
||||
import subprocess
|
||||
from waflib import Context, Logs
|
||||
|
||||
VERSION = '0.4.0'
|
||||
APPNAME = 'PSync'
|
||||
@@ -11,7 +12,6 @@ BOOST_COMPRESSION_CODE = '''
|
||||
#include <boost/iostreams/filter/{0}.hpp>
|
||||
int main() {{ boost::iostreams::{0}_compressor test; }}
|
||||
'''
|
||||
|
||||
COMPRESSION_SCHEMES = ['zlib', 'gzip', 'bzip2', 'lzma', 'zstd']
|
||||
|
||||
def options(opt):
|
||||
@@ -28,8 +28,8 @@ def options(opt):
|
||||
help='Build unit tests')
|
||||
|
||||
for scheme in COMPRESSION_SCHEMES:
|
||||
optgrp.add_option('--without-{}'.format(scheme), action='store_true', default=False,
|
||||
help='Build without {}'.format(scheme))
|
||||
optgrp.add_option(f'--without-{scheme}', action='store_true', default=False,
|
||||
help=f'Disable support for {scheme} (de)compression')
|
||||
|
||||
def configure(conf):
|
||||
conf.load(['compiler_cxx', 'gnu_dirs',
|
||||
@@ -50,19 +50,22 @@ def configure(conf):
|
||||
conf.check_cfg(package='libndn-cxx', args=['libndn-cxx >= 0.8.1', '--cflags', '--libs'],
|
||||
uselib_store='NDN_CXX', pkg_config_path=pkg_config_path)
|
||||
|
||||
boost_libs = ['system', 'iostreams']
|
||||
if conf.env.WITH_TESTS:
|
||||
boost_libs.append('unit_test_framework')
|
||||
|
||||
conf.check_boost(lib=boost_libs, mt=True)
|
||||
conf.check_boost(lib='iostreams', mt=True)
|
||||
if conf.env.BOOST_VERSION_NUMBER < 107100:
|
||||
conf.fatal('The minimum supported version of Boost is 1.71.0.\n'
|
||||
'Please upgrade your distribution or manually install a newer version of Boost.\n'
|
||||
'For more information, see https://redmine.named-data.net/projects/nfd/wiki/Boost')
|
||||
|
||||
for scheme in COMPRESSION_SCHEMES:
|
||||
if getattr(conf.options, 'without_{}'.format(scheme)):
|
||||
if getattr(conf.options, f'without_{scheme}'):
|
||||
continue
|
||||
conf.check_cxx(fragment=BOOST_COMPRESSION_CODE.format(scheme),
|
||||
use='BOOST', execute=False, mandatory=False,
|
||||
msg='Checking for {} support in boost iostreams'.format(scheme),
|
||||
define_name='HAVE_{}'.format(scheme.upper()))
|
||||
msg=f'Checking for {scheme} support in boost iostreams',
|
||||
define_name=f'HAVE_{scheme.upper()}')
|
||||
|
||||
if conf.env.WITH_TESTS:
|
||||
conf.check_boost(lib='unit_test_framework', mt=True, uselib_store='BOOST_TESTS')
|
||||
|
||||
conf.check_compiler_flags()
|
||||
|
||||
@@ -83,13 +86,14 @@ def configure(conf):
|
||||
conf.write_config_header('PSync/detail/config.hpp', define_prefix='PSYNC_')
|
||||
|
||||
def build(bld):
|
||||
bld.shlib(target='PSync',
|
||||
vnum=VERSION,
|
||||
cnum=VERSION,
|
||||
source=bld.path.ant_glob('PSync/**/*.cpp'),
|
||||
use='NDN_CXX BOOST',
|
||||
includes='.',
|
||||
export_includes='.')
|
||||
bld.shlib(
|
||||
target='PSync',
|
||||
vnum=VERSION,
|
||||
cnum=VERSION,
|
||||
source=bld.path.ant_glob('PSync/**/*.cpp'),
|
||||
use='BOOST NDN_CXX',
|
||||
includes='.',
|
||||
export_includes='.')
|
||||
|
||||
if bld.env.WITH_TESTS:
|
||||
bld.recurse('tests')
|
||||
@@ -97,11 +101,10 @@ def build(bld):
|
||||
if bld.env.WITH_EXAMPLES:
|
||||
bld.recurse('examples')
|
||||
|
||||
# Install header files
|
||||
headers = bld.path.ant_glob('PSync/**/*.hpp')
|
||||
bld.install_files('${INCLUDEDIR}', headers, relative_trick=True)
|
||||
|
||||
bld.install_files('${INCLUDEDIR}/PSync/detail',
|
||||
bld.path.find_resource('PSync/detail/config.hpp'))
|
||||
bld.install_files('${INCLUDEDIR}/PSync/detail', 'PSync/detail/config.hpp')
|
||||
|
||||
bld(features='subst',
|
||||
source='PSync.pc.in',
|
||||
@@ -160,16 +163,16 @@ def version(ctx):
|
||||
# first, try to get a version string from git
|
||||
gotVersionFromGit = False
|
||||
try:
|
||||
cmd = ['git', 'describe', '--always', '--match', '%s*' % GIT_TAG_PREFIX]
|
||||
out = subprocess.check_output(cmd, universal_newlines=True).strip()
|
||||
cmd = ['git', 'describe', '--always', '--match', f'{GIT_TAG_PREFIX}*']
|
||||
out = subprocess.run(cmd, capture_output=True, check=True, text=True).stdout.strip()
|
||||
if out:
|
||||
gotVersionFromGit = True
|
||||
if out.startswith(GIT_TAG_PREFIX):
|
||||
Context.g_module.VERSION = out.lstrip(GIT_TAG_PREFIX)
|
||||
else:
|
||||
# no tags matched
|
||||
Context.g_module.VERSION = '%s-commit-%s' % (VERSION_BASE, out)
|
||||
except (OSError, subprocess.CalledProcessError):
|
||||
Context.g_module.VERSION = f'{VERSION_BASE}-commit-{out}'
|
||||
except (OSError, subprocess.SubprocessError):
|
||||
pass
|
||||
|
||||
versionFile = ctx.path.find_node('VERSION.info')
|
||||
@@ -187,17 +190,19 @@ def version(ctx):
|
||||
# already up-to-date
|
||||
return
|
||||
except EnvironmentError as e:
|
||||
Logs.warn('%s exists but is not readable (%s)' % (versionFile, e.strerror))
|
||||
Logs.warn(f'{versionFile} exists but is not readable ({e.strerror})')
|
||||
else:
|
||||
versionFile = ctx.path.make_node('VERSION.info')
|
||||
|
||||
try:
|
||||
versionFile.write(Context.g_module.VERSION)
|
||||
except EnvironmentError as e:
|
||||
Logs.warn('%s is not writable (%s)' % (versionFile, e.strerror))
|
||||
Logs.warn(f'{versionFile} is not writable ({e.strerror})')
|
||||
|
||||
def dist(ctx):
|
||||
ctx.algo = 'tar.xz'
|
||||
version(ctx)
|
||||
|
||||
def distcheck(ctx):
|
||||
ctx.algo = 'tar.xz'
|
||||
version(ctx)
|
||||
|
||||
Reference in New Issue
Block a user