IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 24931


Ignore:
Timestamp:
Jul 28, 2009, 1:32:48 PM (17 years ago)
Author:
jhoblitt
Message:

stub out nebThereCanBeOnlyOne()

Location:
trunk/Nebulous/nebclient/src
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/Nebulous/nebclient/src/nebclient.c

    r24923 r24931  
    883883}
    884884
     885int nebThereCanBeOnlyOne(nebServer *server, const char *key, const char *volume)
     886{
     887    REQUIRE_SERVER;
     888
     889    if (!key) {
     890        nebSetErr(server, "parameter 'key' may not be NULL");
     891
     892        return -1;
     893    }
     894
     895    if (nebPrune(server, key) < 0 ) {
     896    }
     897
     898    nebObjectInstances *locations = NULL;
     899    if (volume) {
     900        locations = nebFindInstances(server, key, NULL);
     901    }
     902
     903    if (locations && locations->n) {
     904        nebObjectInstances *instances = nebFindInstances(server, key, NULL);
     905        for (long i = 0; i < instances->n; i++) {
     906            if (strcmp(locations->URI[0], instances->URI[i])) {
     907                nebDeleteInstance(server, key, instances->URI[i]);
     908            }
     909        }
     910        nebObjectInstancesFree(instances);
     911    }
     912    nebObjectInstancesFree(locations);
     913
     914
     915    return 0;
     916}
     917
    885918
    886919char *nebErr(nebServer *server)
  • trunk/Nebulous/nebclient/src/nebclient.h

    r24923 r24931  
    296296nebObjectStat *nebStat(
    297297    nebServer *server,                  ///< nebServer object
    298     const char *key                     /// storage object key (name)
     298    const char *key                     ///< storage object key (name)
    299299);
    300300
     
    309309int nebChmod(
    310310    nebServer *server,                  ///< nebServer object
    311     const char *key,                    /// storage object key (name)
    312     mode_t mode                         /// chmod(2) compatible mode (mode_t)
     311    const char *key,                    ///< storage object key (name)
     312    mode_t mode                         ///< chmod(2) compatible mode (mode_t)
    313313);
    314314
     
    320320int nebPrune(
    321321    nebServer *server,                  ///< nebServer object
    322     const char *key                     /// storage object key (name)
     322    const char *key                     ///< storage object key (name)
     323);
     324
     325/** Removes all but one instances of an object
     326 *
     327 * @return the number of available instances removed
     328 */
     329
     330int nebThereCanBeOnlyOne(
     331    nebServer *server,                  ///< nebServer object
     332    const char *key,                    ///< storage object key (name)
     333    const char *volume                  ///< leave remain instance on this volume
    323334);
    324335
Note: See TracChangeset for help on using the changeset viewer.