-
Notifications
You must be signed in to change notification settings - Fork 84
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* feat: accesss key * feat: access-key module & access-key cmds * fix: remove redunt error condition * opt: handle wrapper error and remove unused bucket type define in access-key module * fix: return an explicit error instead of panic and optimize the error log (#339) (#341) * feat: add daemon check before execute accesskey commands * optmize: access-key store prefix * optmize: not found error * feat: add s3 signature * chore: * chore: * chore: * chore: * chore: * feat: add store * chore: * feat: s3 access-key, server, handlers, statestore, filestore * chore: * optmize: code structure * style: s3 code structure * style: code structure * optmize: code structure * feat: add multiple context lock * feat: check auth * chore: * chore: * feat: add bucket service * chore: * mod: update bucket lock * chore: * chore: * chore: * del s3d * chore: s3 req & rsp structure * chore: * feat: add multibase commands (#342) * feat: add pubBucket api * feat: add more bucket api * chore: * chore: * feat: add request and response * chore: * feat: server build * chore: check acl * chore * chore: adjust bucket url * � * feat: add auth middleware * feat: adjust code structure * optmize: code structure & auth bug * feat: put object * chore: * mod: mod bucket parse req * optmize: adjust place of response error * chore: mig sig 01 * chore: clear sig * chore: mig sig 02 * chore: mig sig 03 * chore: mig sig 04 * optmize: refractor codes * optmize: rename auth to sign * optmize: code structure & h.name * fix: h.name * feat: put-object * feat: multipart * fix: nslock key * chore: rename s3 constructor file name * fix: tidy example go-ipfs-as-a-library go mod * chore: change default s3 server address to local * mod: add object api * feat: s3-compatible-api - 1. add start option and configure; 2. optmize providers interfaces and implements; 3. rewrite the server construct function * merge: object * chore: add object lock * chore: of delete objs * chore: * fix: list objects bug * chore: rename ListObjetV1Handler to ListObjectHandler, rename BTFS-Hash to CID * refractor: bucket service * refactor: object service * refractor: refract object service * refractor: handlers * refractor: bucket handler * refractor: bucket handler * refractor: response * refractor: response func * refractor: response * refractor: object * feat: add backup and recovery command (#348) * feat: add backup and recovery command * feat: beautify the log * feat: init add recovery option * fix: format error * refractor: object * refractor: objects * refractor: btf api add timeout & add cid refs to enable referred cid can not be deleted * ref: fix delete object remove body * ref: format code * fix: routers * fix: add cors header * fix: router option * feat: add delete objects handler * refractor: multipart * ref: multipart * fix: multipart etag calculation * chore: add min part size todo * chore: upgrade 'github.com/anacrolix/torrent' from v1.47.0 to v1.52.5 * opt: comment and amz header * opt: code * opt: preflight cache max age * feat: bucket response add acl header * opt: change cid-list header to cid * fix: required check exlude unknow location * fix: get object acl * ref: requests * ref: complete refractor * fix: args parse * fix: get object unlock * fix: object acl writer * fix: delete objects error * fix: Sign handler name * fix: object name escape * fix: copy source validate * chore: fix * opt: s3 log * opt: s3 api log * fix: allow Cache-Control header in PutObject and CopyObject Action * feat: log details (#349) * feat: add backup and recovery command * feat: beautify the log * feat: init add recovery option * fix: format error * feat: log details * opt: add access-key command taglines * opt: add accesskey command description * chore: add out of FixChequeCashOutCmd * chore: * chore * chore: * chore: * chore: * chore * chore: add accesskey commands test path * chore: * chore: add accesskey test path * chore: * chore: * chore: * chore: --------- Co-authored-by: Steve <[email protected]> Co-authored-by: Shawn-Huang-Tron <[email protected]> Co-authored-by: fish <[email protected]>
- Loading branch information
1 parent
9921801
commit 45abbb3
Showing
11 changed files
with
387 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
package cheque | ||
|
||
import ( | ||
"fmt" | ||
cmds "github.com/bittorrent/go-btfs-cmds" | ||
"github.com/bittorrent/go-btfs/chain" | ||
"github.com/bittorrent/go-btfs/chain/tokencfg" | ||
"github.com/bittorrent/go-btfs/utils" | ||
"github.com/google/martian/log" | ||
"golang.org/x/net/context" | ||
"io" | ||
) | ||
|
||
var FixChequeCashOutCmd = &cmds.Command{ | ||
Helptext: cmds.HelpText{ | ||
Tagline: "List cheque(s) received from peers.", | ||
}, | ||
Run: func(req *cmds.Request, res cmds.ResponseEmitter, env cmds.Environment) error { | ||
err := utils.CheckSimpleMode(env) | ||
if err != nil { | ||
return err | ||
} | ||
|
||
listRet := ListFixChequeRet{} | ||
listRet.FixCheques = make([]fixCheque, 0) | ||
|
||
for _, tokenAddr := range tokencfg.MpTokenAddr { | ||
cheques, err := chain.SettleObject.SwapService.LastReceivedCheques(tokenAddr) | ||
if err != nil { | ||
return err | ||
} | ||
|
||
for k, v := range cheques { | ||
totalCashOutAmount, newCashOutAmount, err := chain.SettleObject.CashoutService.AdjustCashCheque( | ||
context.Background(), v.Vault, v.Beneficiary, tokenAddr, false) | ||
if err != nil { | ||
return err | ||
} | ||
if newCashOutAmount != nil && newCashOutAmount.Uint64() > 0 { | ||
var record fixCheque | ||
record.PeerID = k | ||
record.Token = v.Token.String() | ||
record.Beneficiary = v.Beneficiary.String() | ||
record.Vault = v.Vault.String() | ||
record.TotalCashedAmount = totalCashOutAmount | ||
record.FixCashedAmount = newCashOutAmount | ||
|
||
listRet.FixCheques = append(listRet.FixCheques, record) | ||
} | ||
} | ||
} | ||
listRet.Len = len(listRet.FixCheques) | ||
|
||
log.Infof("FixChequeCashOutCmd, listRet = %+v", listRet) | ||
|
||
return cmds.EmitOnce(res, &listRet) | ||
}, | ||
Type: ListFixChequeRet{}, | ||
Encoders: cmds.EncoderMap{ | ||
cmds.Text: cmds.MakeTypedEncoder(func(req *cmds.Request, w io.Writer, out *ListFixChequeRet) error { | ||
fmt.Fprintf(w, "fix: \n\t%-55s\t%-46s\t%-46s\t%-46s\tfix_cash_amount: \n", "peerID:", "vault:", "beneficiary:", "total_cash_amount:") | ||
for iter := 0; iter < out.Len; iter++ { | ||
fmt.Fprintf(w, "\t%-55s\t%-46s\t%-46s\t%d\t%d \n", | ||
out.FixCheques[iter].PeerID, | ||
out.FixCheques[iter].Vault, | ||
out.FixCheques[iter].Beneficiary, | ||
out.FixCheques[iter].TotalCashedAmount.Uint64(), | ||
out.FixCheques[iter].FixCashedAmount.Uint64(), | ||
) | ||
} | ||
|
||
return nil | ||
}), | ||
}, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.