Browse Source

[2575] documentation updates

JINMEI Tatuya 12 years ago
parent
commit
84bc0b71b8
3 changed files with 47 additions and 0 deletions
  1. 30 0
      src/lib/datasrc/client.h
  2. 15 0
      src/lib/datasrc/database.h
  3. 2 0
      src/lib/datasrc/sqlite3_accessor.h

+ 30 - 0
src/lib/datasrc/client.h

@@ -389,6 +389,36 @@ public:
     /// \return True if the zone was added, false if it already existed
     /// \return True if the zone was added, false if it already existed
     virtual bool createZone(const dns::Name& zone_name);
     virtual bool createZone(const dns::Name& zone_name);
 
 
+    /// \brief Delete a zone from the data source
+    ///
+    /// This method also checks if the specified zone exists in the data
+    /// source, and returns true/false depending on whether the zone
+    /// existed/not existed, respectively.  In either case, on successful
+    /// return it ensures the data source does not contain the specified
+    /// name of the zone.
+    ///
+    /// \note This is a tentative API, and this method is likely to change
+    /// or be removed in the near future. For that reason, it currently
+    /// provides a default implementation that throws NotImplemented.
+    /// Note also that this method does not delete other database records
+    /// related to the zone, such as zone's resource records or differences
+    /// corresponding to updates made in the zone.  This is primarily for
+    /// implementation simplicity (in the currently intended usage there
+    /// wouldn't be such other data at the time of this call anyway) and due
+    /// to the fact that details of managing zones is still in flux.  Once
+    /// the design in this area is fixed we may revisit the behavior.
+    ///
+    /// Apart from the two exceptions mentioned below, in theory this
+    /// call can throw anything, depending on the implementation of
+    /// the datasource backend.
+    ///
+    /// \throw NotImplemented If the datasource backend does not support
+    ///                       direct zone deletion.
+    /// \throw DataSourceError If something goes wrong in the data source
+    ///                        while deleting the zone.
+    /// \param zone_name The (fully qualified) name of the zone to be deleted
+    /// \return true if the zone previously existed and has been deleted by
+    /// this method; false if the zone didn't exist.
     virtual bool deleteZone(const dns::Name& zone_name);
     virtual bool deleteZone(const dns::Name& zone_name);
 };
 };
 }
 }

+ 15 - 0
src/lib/datasrc/database.h

@@ -195,6 +195,21 @@ public:
     ///         or was created by this call).
     ///         or was created by this call).
     virtual int addZone(const std::string& name) = 0;
     virtual int addZone(const std::string& name) = 0;
 
 
+    /// \brief Delete a zone from the database
+    ///
+    /// Like for deleteRecordToZone, implementations are not required to
+    /// check for the existence of the given zone name, it is the
+    /// responsibility of the caller to do so.
+    ///
+    /// Callers must also start a transaction before calling this method.
+    /// Implementations should throw InvalidOperation if this has not been
+    /// done. Callers should also expect DataSourceError for other potential
+    /// problems specific to the database.
+    ///
+    /// \note This method does not delete other database records related to
+    /// the zone.  See \c DataSourceClient::deleteZone for the rationale.
+    ///
+    /// \param zone_id The ID of the zone, that would be returned by getZone().
     virtual void deleteZone(int zone_id) = 0;
     virtual void deleteZone(int zone_id) = 0;
 
 
     /// \brief This holds the internal context of ZoneIterator for databases
     /// \brief This holds the internal context of ZoneIterator for databases

+ 2 - 0
src/lib/datasrc/sqlite3_accessor.h

@@ -139,6 +139,8 @@ public:
     /// \return the id of the zone that has been added
     /// \return the id of the zone that has been added
     virtual int addZone(const std::string& name);
     virtual int addZone(const std::string& name);
 
 
+    // Nothing special to add for this implementation (the base class
+    // description is sufficient).
     virtual void deleteZone(int zone_id);
     virtual void deleteZone(int zone_id);
 
 
     /// \brief Look up all resource records for a name
     /// \brief Look up all resource records for a name