Split application orchestration by responsibility
This commit is contained in:
parent
f28810ea33
commit
37a7a55bfe
1 changed files with 1545 additions and 1265 deletions
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Reference in a new issue