Skip to content

Commit

Permalink
update!: changed the whole of APIs
Browse files Browse the repository at this point in the history
  • Loading branch information
sttk committed Sep 28, 2023
1 parent d4d633b commit 91ba5f9
Show file tree
Hide file tree
Showing 44 changed files with 3,089 additions and 2,334 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ hs_err_pid*

# Directories
target/
test-results-native/

# OS generating files
.DS_Store
Expand Down
40 changes: 40 additions & 0 deletions src/main/java/com/github/sttk/sabi/AsyncGroup.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
/*
* AsyncGroup class.
* Copyright (C) 2023 Takayuki Sato. All Rights Reserved.
*/
package com.github.sttk.sabi;

import com.github.sttk.sabi.errs.Err;

import java.util.Map;
import java.util.HashMap;

/**
* {@code AsyncGroup} is the inferface to execute added {@link Runner}(s)
* asynchronously.
* <p>
* The method Add is to add target {@link Runner}(s).
* This interface is used as an argument of {@link DaxSrc#setup}, {@link
* DaxConn#commit}, and {@link DaxConn#rollback}.
*/
public interface AsyncGroup {

/**
* {@code RunnerFailed} is an error reason which indicates that a {@link
* Runner} failed.
*/
record RunnerFailed() {}

/**
* {@code RunnerInterrupted} is an error reason which indicates that a {@link
* Runner}'s thread is interrupted.
*/
record RunnerInterrupted() {}

/**
* Adds a runner to be run asynchronously.
*
* @param runner A {@link Runner} object.
*/
void add(Runner runner);
}
30 changes: 30 additions & 0 deletions src/main/java/com/github/sttk/sabi/Dax.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
/*
* Dax class.
* Copyright (C) 2022-2023 Takayuki Sato. All Rights Reserved.
*/
package com.github.sttk.sabi;

import com.github.sttk.sabi.errs.Err;

/**
* Dax is the interface for a set of data access methods.
*
* This interface is inherited by Dax implementations for data stores, and
* each Dax implementation defines data access methods to each data store.
* In data access methods, {@link DaxConn} instances conected to data stores
* can be obtained with {@link #getDaxConn} method.
*/
public interface Dax {

/**
* Gets a DaxConn instance associated with the argument name.
* The name is same as what was registered with DaxSrc using {@link
* Sabi#uses} method.
*
* @param <C> The type of a {@link DaxConn}.
* @param name A name of a {@link DaxConn}.
* @return A {@link DaxConn} instance.
* @throws Err If getting a {@link DaxConn} fails.
*/
<C extends DaxConn> C getDaxConn(String name) throws Err;
}
Loading

0 comments on commit 91ba5f9

Please sign in to comment.