Exemplo n.º 1
0
int
d_sampleRequestCompare(
    d_sampleRequest request1,
    d_sampleRequest request2)
{
    int result;
    assert(request1);
    assert(request2);

    if(request1 && request2){
        result = strcmp(request1->partition, request2->partition);

        if(result == 0){
            result = strcmp(request1->topic, request2->topic);

            if(result == 0){
                if(request1->durabilityKind == request2->durabilityKind){
                    result = d_networkAddressCompare(
                                    &request1->source, &request2->source);

                } else if(request1->durabilityKind > request2->durabilityKind){
                    result = 1;
                } else {
                    result = -1;
                }
            }
        }
    } else if(request1){
        result = 1;
    } else {
        result = -1;
    }
    return result;
}
Exemplo n.º 2
0
static void
checkFellowMasterWalk(
    void* o,
    c_voidp userData)
{
    struct checkFellowMasterHelper* helper;
    d_networkAddress master;
    d_nameSpace nameSpace;

    helper = (struct checkFellowMasterHelper*)userData;
    nameSpace = d_nameSpace(o);
    master = d_nameSpaceGetMaster (nameSpace);

    if (d_nameSpaceIsMasterConfirmed (nameSpace)) {
        if (!d_networkAddressCompare (helper->fellow, master)) {
            d_adminReportMaster (helper->admin, nameSpace, helper->oldNameSpace);
        }
    }

    d_networkAddressFree (master);
}
Exemplo n.º 3
0
static void
checkFellowMasterWalk(
    void* o,
    c_voidp userData)
{
    struct checkFellowMasterHelper* helper;
    d_networkAddress master, fellow;
    d_nameSpace nameSpace;

    helper = (struct checkFellowMasterHelper*)userData;
    nameSpace = d_nameSpace(o);
    master = d_nameSpaceGetMaster (nameSpace);
    fellow = d_fellowGetAddress(helper->fellow);

    if (!d_networkAddressCompare (fellow, master)) {
        d_adminReportMaster (helper->admin, helper->fellow, nameSpace, helper->oldNameSpace);
    }

    d_networkAddressFree(master);
    d_networkAddressFree(fellow);
}
Exemplo n.º 4
0
static void
checkFellowMasterWalk(
    void* o,
    c_voidp userData)
{
    struct checkFellowMasterHelper* helper;
    d_networkAddress master, fellow;
    d_nameSpace nameSpace;

    helper = (struct checkFellowMasterHelper*)userData;
    nameSpace = d_nameSpace(o);                     /* the namespace of the fellow */
    master = d_nameSpaceGetMaster (nameSpace);      /* the master of the namespace of the fellow */
    fellow = d_fellowGetAddress(helper->fellow);    

    /* Only start checking for conflicts if the fellow is a master
     * for the namespace and the namespace is confirmed
     */
    if (!d_networkAddressCompare (fellow, master) && d_nameSpaceIsMasterConfirmed(nameSpace)) {
        d_adminReportMaster (helper->admin, helper->fellow, nameSpace, helper->oldNameSpace);
    }

    d_networkAddressFree(master);
    d_networkAddressFree(fellow);
}