/// of it. In that case, node parameter is left intact.
//@{
- /// \brief Simple find.
- ///
- /// Acts as described in the \ref find section.
- Result find(const isc::dns::Name& name,
- DomainTreeNode<T>** node) const {
- DomainTreeNodeChain<T, DomainTreeNode<T> > node_path;
- const isc::dns::LabelSequence ls(name);
- return (find<void*, DomainTreeNode<T> >(ls, node, node_path, NULL,
- NULL));
- }
-
/// \brief Simple find returning immutable node.
///
/// Acts as described in the \ref find section, but returns immutable node
return (ret);
}
- /// \brief Simple find, with node_path tracking
- ///
- /// Acts as described in the \ref find section.
- Result find(const isc::dns::Name& name, DomainTreeNode<T>** node,
- DomainTreeNodeChain<T>& node_path) const
- {
- const isc::dns::LabelSequence ls(name);
- return (find<void*, const DomainTreeNode<T> >(ls, node, node_path,
- NULL, NULL));
- }
-
/// \brief Simple find returning immutable node, with node_path tracking
///
/// Acts as described in the \ref find section, but returns immutable node
return (ret);
}
- /// \brief Simple find returning immutable node.
- ///
- /// Acts as described in the \ref find section, but returns immutable
- /// node pointer.
- template <typename CBARG>
- Result find(const isc::dns::Name& name,
- const DomainTreeNode<T>** node,
- DomainTreeNodeChain<T>& node_path,
- bool (*callback)(const DomainTreeNode<T>&, CBARG),
- CBARG callback_arg) const
- {
- const DomainTreeNode<T>* target_node = NULL;
- const isc::dns::LabelSequence ls(name);
- Result ret = find(ls, &target_node, node_path, callback,
- callback_arg);
- if (ret != NOTFOUND) {
- *node = target_node;
- }
- return (ret);
- }
-
/// \brief Find with callback and node chain
/// \anchor callback
///
/// \c true, it returns immediately with the current node.
template <typename CBARG, typename NodeType>
Result find(const isc::dns::LabelSequence& target_labels_orig,
- NodeType** node,
+ const NodeType** node,
DomainTreeNodeChain<T, NodeType>& node_path,
bool (*callback)(const DomainTreeNode<T>&, CBARG),
CBARG callback_arg) const;
template <typename CBARG, typename NodeType>
typename DomainTree<T>::Result
DomainTree<T>::find(const isc::dns::LabelSequence& target_labels_orig,
- NodeType** target,
+ const NodeType** target,
DomainTreeNodeChain<T, NodeType>& node_path,
bool (*callback)(const DomainTreeNode<T>&, CBARG),
CBARG callback_arg) const
const std::string
InMemoryClient::getFileName(const isc::dns::Name& zone_name) const {
- FileNameNode* node(NULL);
+ const FileNameNode* node(NULL);
FileNameTree::Result result = impl_->file_name_tree_->find(zone_name,
&node);
if (result == FileNameTree::EXACTMATCH) {
}
}
-result::Result
-InMemoryClient::add(const isc::dns::Name& zone_name,
- const ConstRRsetPtr& rrset)
-{
- const ZoneTable::FindResult result =
- impl_->zone_table_->findZone(zone_name);
- if (result.code != result::SUCCESS) {
- isc_throw(DataSourceError, "No such zone: " + zone_name.toText());
- }
-
- const ConstRRsetPtr sig_rrset =
- rrset ? rrset->getRRsig() : ConstRRsetPtr();
- impl_->add(rrset, sig_rrset, zone_name, *result.zone_data);
-
- // add() doesn't allow duplicate add, so we always return SUCCESS.
- return (result::SUCCESS);
-}
-
namespace {
class MemoryIterator : public ZoneIterator {
/// zone from a file before.
const std::string getFileName(const isc::dns::Name& zone_name) const;
- /// \brief Inserts an rrset into the zone.
- ///
- /// It puts another RRset into the zone.
- ///
- /// In the current implementation, this method doesn't allow an existing
- /// RRset to be updated or overridden. So the caller must make sure that
- /// all RRs of the same type and name must be given in the form of a
- /// single RRset. The current implementation will also require that
- /// when an RRSIG is added, the RRset to be covered has already been
- /// added. These restrictions are probably too strict when this data
- /// source accepts various forms of input, so they should be revisited
- /// later.
- ///
- /// Except for NullRRset and OutOfZone, this method does not guarantee
- /// strong exception safety (it is currently not needed, if it is needed
- /// in future, it should be implemented).
- ///
- /// \throw NullRRset \c rrset is a NULL pointer.
- /// \throw OutOfZone The owner name of \c rrset is outside of the
- /// origin of the zone.
- /// \throw AddError Other general errors.
- /// \throw Others This method might throw standard allocation exceptions.
- ///
- /// \param rrset The set to add.
- /// \return SUCCESS or EXIST (if an rrset for given name and type already
- /// exists).
- result::Result add(const isc::dns::Name& zone_name,
- const isc::dns::ConstRRsetPtr& rrset);
-
/// \brief RRset is NULL exception.
///
/// This is thrown if the provided RRset parameter is NULL.