Skip to content

Commit

Permalink
Add picture
Browse files Browse the repository at this point in the history
  • Loading branch information
g41797 committed Dec 30, 2024
1 parent 87d52c6 commit 47bd5f2
Show file tree
Hide file tree
Showing 8 changed files with 46 additions and 58 deletions.
16 changes: 9 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,12 @@
![](_logo/1p0c_8c0637.jpg)

# beanstalkz
[![CI](https://github.com/g41797/beanstalkz/actions/workflows/ci.yml/badge.svg)](https://github.com/g41797/beanstalkz/actions/workflows/ci.yml)


WIP


```txt
Job lifecycle
Expand All @@ -15,11 +24,4 @@
```


# beanstalkz
[![CI](https://github.com/g41797/beanstalkz/actions/workflows/ci.yml/badge.svg)](https://github.com/g41797/beanstalkz/actions/workflows/ci.yml)


WIP


<br />
Binary file added _logo/1p0c_8c0637.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed _logo/CLion_icon.png
Binary file not shown.
19 changes: 0 additions & 19 deletions _logo/CLion_icon.svg

This file was deleted.

4 changes: 1 addition & 3 deletions _logo/attribution.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,2 @@
Copyright © 2024 JetBrains s.r.o. CLion and the CLion logo are trademarks of JetBrains s.r.o.

https://www.jetbrains.com/company/brand/#logos-and-icons
By Illustrated London News, 1863, Public Domain, https://commons.wikimedia.org/w/index.php?curid=12233394

8 changes: 7 additions & 1 deletion _notes.txt
Original file line number Diff line number Diff line change
Expand Up @@ -296,4 +296,10 @@ Build System Tricks
https://ziggit.dev/t/build-system-tricks/3531

Check connection
sudo netstat --tcp --programs --numeric|grep 11300
sudo netstat --tcp --programs --numeric|grep 11300

Zig callbacks
https://ziggit.dev/t/how-to-use-callbacks-with-run-time-arguments/2449
https://stackoverflow.com/questions/74251650/how-to-pass-zig-function-pointers-to-other-functions
https://ziglang.org/documentation/master/#Functions

29 changes: 1 addition & 28 deletions src/client.zig
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,13 @@ const http = std.http;
const Connection = http.Client.Connection;
const Mutex = std.Thread.Mutex;
const Allocator = std.mem.Allocator;
const EnumMap = std.enums.EnumMap;

const err = @import("err.zig");
const ReturnedError = err.ReturnedError;
const parse = @import("parse.zig");
const tubename = @import("name.zig");
const Job = @import("job.zig").Job;
pub const JobState = @import("job.zig").JobState;

pub const DefaultAddr = "127.0.0.1";
pub const DafaultPort = 11300;
Expand All @@ -37,33 +37,6 @@ pub const DefaultTTR = 60; // 1 minute

pub const MaxReadLineLen = 256;

pub const JobState = enum {
delayed,
ready,
reserved,
buried,

pub fn to_string(js: JobState) ?[]const u8 {
return JobStateMap.get(js);
}

pub fn from_string(str: []const u8) ?JobState {
if (str.len == 0) {
return null;
}

const result = std.meta.stringToEnum(JobState, str);
return result;
}
};

pub const JobStateMap = EnumMap(JobState, []u8).init(.{
.delayed = "delayed",
.ready = "ready",
.reserved = "reserved",
.buried = "buried",
});

pub const Client = struct {
mutex: Mutex = .{},
allocator: Allocator = undefined,
Expand Down
28 changes: 28 additions & 0 deletions src/job.zig
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,34 @@

const std = @import("std");
const Allocator = std.mem.Allocator;
const EnumMap = std.enums.EnumMap;

pub const JobState = enum {
delayed,
ready,
reserved,
buried,

pub fn to_string(js: JobState) ?[]const u8 {
return JobStateMap.get(js);
}

pub fn from_string(str: []const u8) ?JobState {
if (str.len == 0) {
return null;
}

const result = std.meta.stringToEnum(JobState, str);
return result;
}
};

const JobStateMap = EnumMap(JobState, []u8).init(.{
.delayed = "delayed",
.ready = "ready",
.reserved = "reserved",
.buried = "buried",
});

pub const Job = struct {
ready: bool = false,
Expand Down

0 comments on commit 47bd5f2

Please sign in to comment.