-
Notifications
You must be signed in to change notification settings - Fork 73
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Pipy Repo REST API didn't work #178
Comments
@Hou-Xiaoxuan Sorry for the confusion, and the doc is not update to date. The POST method to the For file operation, the API is Here is a sample script for codebase initialization, for your reference:
|
I found the API related code at BTW, I wonder if there is an API to let Pipy program exit? ( not the running repo but all pipy admin server) @ethinx |
@Hou-Xiaoxuan HTTP API? I don't think we have such kind of API, maybe you could elaborate on the senario... |
we're working on wrap pipy as a rust crate to to simplify the use of pipy/ztm in rust, in this repo. #[link(name = "pipy", kind = "dylib")]
extern "C" {
pub fn pipy_main(argc: c_int, argv: *const *const c_char) -> c_int;
}
/// start pipy in repo mod with given port, default port is 6060
/// **Note**: If you invoke this function, you must call `libc::exit(0)` to exit the process finally,
/// otherwise the `pipy-main` thread will report a `panic!` when the process exits.
pub fn start_pipy_repo(port: Option<u16>) {
thread::spawn(move || {
let mut args: Vec<CString> = vec![];
args.push(CString::new("pipy-rs").unwrap());
args.push(CString::new(format!("--admin-port={}", port.unwrap_or(6060))).unwrap());
let c_args: Vec<*const c_char> = args
.iter()
.map(|arg| <CString as Clone>::clone(&arg).into_raw() as *const c_char)
.collect();
unsafe {
pipy_main(c_args.len() as c_int, c_args.as_ptr());
}
});
thread::sleep(std::time::Duration::from_secs(1)); // wait for pipy to start
} But we just can't terminate the pipy program appropriately because rust doesn't allow you to kill a thread directly. So I wish there was some way to stop pipy's main function from running. Related works: flomesh-io/ztm#9 |
@pajama-coder do you have any suggestion for the situation? |
@Hou-Xiaoxuan I've added an exported function |
@Hou-Xiaoxuan Hi, have you tried that solution in last comment? |
It works well in worker mode, but didn't exit in repo mode. |
Try REST API in https://flomesh.io/pipy/docs/zh/operating/repo/3-api, the interface behavior is inconsistent with expectations.
Repeat method:
The update file interface appears to be recognized as the new repo interface。
Pipy version:
The text was updated successfully, but these errors were encountered: