Created some queue types. Source sync.

This commit is contained in:
Brad Arant 2024-07-16 16:50:20 -07:00
parent cd428909b8
commit e6ccda8bca
12 changed files with 106 additions and 12 deletions

20
Flow.cpp Normal file
View File

@ -0,0 +1,20 @@
#include "FlowAction.h"
namespace http {
FlowAction::FlowAction() {
int len = strlen(hex);
for(int ix = 0; ix < sizeof(actionId); ++ix) {
actionId[ix] = hex[random() % len];
}
}
bool FlowAction::action(HTTPParameters &p) {
return true;
}
coreutils::ZString FlowAction::getId() {
return coreutils::ZString(actionId, sizeof(actionId));
}
}

26
Flow.h Normal file
View File

@ -0,0 +1,26 @@
#ifndef __Flow_h__
# define __Flow_h__
#include "HTTPParameters.h"
#include "MString.h"
namespace http {
class Flow {
public:
Flow();
virtual bool action(HTTPParameters &p);
coreutils::ZString getId();
protected:
char actionId[64];
const char *hex = "0123456789ABCDEF";
};
}
#endif

View File

@ -17,5 +17,4 @@ namespace http {
return coreutils::ZString(actionId, sizeof(actionId));
}
}

View File

@ -1 +1,2 @@
#ifndef __FlowPoint_h__

20
FlowQueue.cpp Normal file
View File

@ -0,0 +1,20 @@
#include "FlowAction.h"
namespace http {
FlowAction::FlowAction() {
int len = strlen(hex);
for(int ix = 0; ix < sizeof(actionId); ++ix) {
actionId[ix] = hex[random() % len];
}
}
bool FlowAction::action(HTTPParameters &p) {
return true;
}
coreutils::ZString FlowAction::getId() {
return coreutils::ZString(actionId, sizeof(actionId));
}
}

26
FlowQueue.h Normal file
View File

@ -0,0 +1,26 @@
#ifndef __FlowQueue_h__
# define __FlowQueue_h__
#include "HTTPParameters.h"
#include "ZString.h"
namespace http {
class FlowQueue {
public:
FlowQueue();
virtual bool process();
coreutils::ZString getId();
protected:
char actionId[64];
const char *hex = "0123456789ABCDEF";
};
}
#endif

View File

@ -8,7 +8,7 @@ namespace http {
HTTPEntryPoints::HTTPEntryPoints() : index("testview1"), notfound("testview1") {}
coreutils::ZString HTTPEntryPoints::getView(coreutils::ZString &uri) {
coreutils::ZString HTTPEntryPoints::getFlow(coreutils::ZString &uri) {
if(uri == "/") {
return index;
}

View File

@ -13,7 +13,7 @@ namespace http {
public:
HTTPEntryPoints();
coreutils::ZString getView(coreutils::ZString &uri);
coreutils::ZString getFlow(coreutils::ZString &uri);
private:
coreutils::ZString index;

View File

@ -22,9 +22,11 @@ namespace http {
// TODO: What should we do if we receive a request on a GET and there is a session variable?
// If its an entry point then is it an image or link to a downloadable content that was issued
// by the page? Referer must point to the proper entity.
// by the page? Referer must point to the proper entity.
//
// DOCUMENT: The root entry point should always be a GET request to root page.
entryPoints.processCommand(p);
// entryPoints.processCommand(p);
// TODO: Right here we need to do a lookup to the entry table. File requests need an entry point URL to serve.
// TODO: Allow entry points to specify pages in the page cache or do we treat pages as automatic entry points.

BIN
HTTPServer Executable file

Binary file not shown.

View File

@ -21,7 +21,7 @@ int main(int argc, char **argv) {
http::HTTPSessions httpSessions;
http::HTTPServer http(ePoll, core::IPAddress(ipAddress, 80), httpSessions);
http::HTTPServer http(ePoll, core::IPAddress(ipAddress, 8080), httpSessions);
core::ConsoleServer console(ePoll, core::IPAddress(ipAddress, 1027));
console.commands.add(ePoll, "threads");

View File

@ -2,12 +2,12 @@
"action": "default",
"text": "Default Flow",
"queues": [
{
"type": "XQ",
"view": "default",
"actions": [
{
"
{
"type": "XQ",
"view": "default",
"actions": [
{
"
}
]
}