Split application orchestration by responsibility

This commit is contained in:
ms2k 2026-07-19 18:22:33 +09:00
commit 37a7a55bfe
3 changed files with 1545 additions and 1265 deletions

View file

@ -25,14 +25,47 @@ import Nuthatch.App
import Nuthatch.Config
import Nuthatch.Db
import qualified Nuthatch.Db as Db
import qualified Nuthatch.Mutation.Service as Mutation
import Nuthatch.Mutation.Service (runDelete)
import Nuthatch.Protocol
import Nuthatch.Redis
import Nuthatch.S3
import Nuthatch.Transfer (inspectBandwidth, transferPieceSize)
import Nuthatch.Types
import Servant.Types.SourceT (SourceT (..), StepT (..), source)
import System.Environment (getArgs)
import System.IO (BufferMode (LineBuffering), hSetBuffering, stdout)
runPut
:: Env
-> SessionUser
-> Root
-> RelativePath
-> OperationId
-> Integer
-> ContentSha256
-> SourceT IO BS.ByteString
-> IO (Either Mutation.PutFailure MutationResult)
runPut env user root path operation size identity body =
Mutation.runPut
env
user
root
path
operation
size
identity
(\key ->
putObjectStream
(envS3 env)
key
size
(Just identity)
(transferPieceSize env)
(inspectBandwidth env user)
body
>>= pure . either (Left . Mutation.PutDispatchFailed) Right)
main :: IO ()
main = do
hSetBuffering stdout LineBuffering

View file

@ -6,10 +6,11 @@ import qualified Data.ByteString as BS
import qualified Data.ByteString.Lazy as BL
import Data.Text (Text)
import qualified Data.Text as T
import Nuthatch.App (dispatchAndFinalize, newEnv)
import Nuthatch.App (newEnv)
import Nuthatch.Config
import Nuthatch.Db
import qualified Nuthatch.Db as Db
import Nuthatch.Mutation.Service (dispatchAndFinalize)
import Nuthatch.Protocol
import Nuthatch.Redis
import Nuthatch.S3

View file

@ -82,18 +82,18 @@ import Network.Wai.Test
)
import Nuthatch.Api
import Nuthatch.Audit (auditValue, objectKeyFields)
import Nuthatch.App
( authenticationHandler
, collectKeysBoundedWith
, loginResponse
, utf8Boundary
)
import Nuthatch.Browse (collectKeysBoundedWith)
import Nuthatch.Config
( Config (..)
, parseRedisUri
, secret
, validateAbsoluteUri
)
import Nuthatch.Http.Auth
( authenticationHandler
, loginResponse
)
import Nuthatch.Http.Server (utf8Boundary)
import Nuthatch.Oidc (OidcIdentity (..), verifyIdToken)
import Nuthatch.Paths
( buildObjectKey