Ejemplo n.º 1
0
u_waitsetEvent
u_waitsetPersistentSnapshotEventNew(
    u_entity e,
    c_ulong k,
    v_handle source,
    const c_char* partitionExpr,
    const c_char* topicExpr,
    const c_char* uri)
{
    u_waitsetEvent event;

    event = (u_waitsetEvent)os_malloc(C_SIZEOF(u_waitsetPersistentSnapshotEvent));

    if (event) {
        event->entity                 = e;
        event->events                 = k;
        event->kind                   = U_WAITSET_EVENT_PERSISTENT_SNAPSHOT;

        u_waitsetPersistentSnapshotEvent(event)->partitionExpr      = os_strdup(partitionExpr);
        u_waitsetPersistentSnapshotEvent(event)->topicExpr          = os_strdup(topicExpr);
        u_waitsetPersistentSnapshotEvent(event)->uri                = os_strdup(uri);
        u_waitsetPersistentSnapshotEvent(event)->source.server      = source.server;
        u_waitsetPersistentSnapshotEvent(event)->source.index       = source.index;
        u_waitsetPersistentSnapshotEvent(event)->source.serial      = source.serial;
    }
    return event;
}
Ejemplo n.º 2
0
void
u_waitsetEventFree(
    u_waitsetEvent event)
{
    c_long i;

    if (event) {
        switch(event->kind){
            case U_WAITSET_EVENT:
                /*Do nothing*/
                break;
            case U_WAITSET_EVENT_HISTORY_DELETE:
                os_free(u_waitsetHistoryDeleteEvent(event)->partitionExpr);
                os_free(u_waitsetHistoryDeleteEvent(event)->topicExpr);
                break;
            case U_WAITSET_EVENT_HISTORY_REQUEST:
                if(u_waitsetHistoryRequestEvent(event)->filter){
                    os_free(u_waitsetHistoryRequestEvent(event)->filter);
                }
                for(i=0; i<u_waitsetHistoryRequestEvent(event)->filterParamsCount; i++){
                    os_free(u_waitsetHistoryRequestEvent(event)->filterParams[i]);
                }

                if(u_waitsetHistoryRequestEvent(event)->filterParams){
                    os_free(u_waitsetHistoryRequestEvent(event)->filterParams);
                }
                break;
            case U_WAITSET_EVENT_PERSISTENT_SNAPSHOT:
                if(u_waitsetPersistentSnapshotEvent(event)->partitionExpr)
                {
                    os_free(u_waitsetPersistentSnapshotEvent(event)->partitionExpr);
                }
                if(u_waitsetPersistentSnapshotEvent(event)->topicExpr)
                {
                    os_free(u_waitsetPersistentSnapshotEvent(event)->topicExpr);
                }
                if(u_waitsetPersistentSnapshotEvent(event)->uri)
                {
                    os_free(u_waitsetPersistentSnapshotEvent(event)->uri);
                }
                break;
            case U_WAITSET_EVENT_CONNECT_WRITER:
                break;
            default:
                break;
        }
        os_free(event);
    }
}