Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
client
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Terraform modules
Analyze
Contributor analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
elixxir
client
Commits
4e211d24
Commit
4e211d24
authored
3 years ago
by
Jono Wenger
Browse files
Options
Downloads
Patches
Plain Diff
Fix file transfer manager function order and comments
parent
dc6612bc
Branches
Branches containing commit
Tags
Tags containing commit
2 merge requests
!510
Release
,
!207
WIP: Client Restructure
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
fileTransfer/manager.go
+26
-20
26 additions, 20 deletions
fileTransfer/manager.go
with
26 additions
and
20 deletions
fileTransfer/manager.go
+
26
−
20
View file @
4e211d24
...
...
@@ -128,26 +128,6 @@ type manager struct {
rng
*
fastRNG
.
StreamGenerator
}
// MaxFileNameLen returns the max number of bytes allowed for a file name.
func
(
m
*
manager
)
MaxFileNameLen
()
int
{
return
FileNameMaxLen
}
// MaxFileTypeLen returns the max number of bytes allowed for a file type.
func
(
m
*
manager
)
MaxFileTypeLen
()
int
{
return
FileTypeMaxLen
}
// MaxFileSize returns the max number of bytes allowed for a file.
func
(
m
*
manager
)
MaxFileSize
()
int
{
return
FileMaxSize
}
// MaxPreviewSize returns the max number of bytes allowed for a file preview.
func
(
m
*
manager
)
MaxPreviewSize
()
int
{
return
PreviewMaxSize
}
type
Cmix
interface
{
GetMaxMessageLength
()
int
SendMany
(
messages
[]
cmix
.
TargetedCmixMessage
,
p
cmix
.
CMIXParams
)
(
id
.
Round
,
...
...
@@ -239,6 +219,28 @@ func (m *manager) StartProcesses() (stoppable.Stoppable, error) {
return
multiStoppable
,
nil
}
// MaxFileNameLen returns the max number of bytes allowed for a file name.
func
(
m
*
manager
)
MaxFileNameLen
()
int
{
return
FileNameMaxLen
}
// MaxFileTypeLen returns the max number of bytes allowed for a file type.
func
(
m
*
manager
)
MaxFileTypeLen
()
int
{
return
FileTypeMaxLen
}
// MaxFileSize returns the max number of bytes allowed for a file.
func
(
m
*
manager
)
MaxFileSize
()
int
{
return
FileMaxSize
}
// MaxPreviewSize returns the max number of bytes allowed for a file preview.
func
(
m
*
manager
)
MaxPreviewSize
()
int
{
return
PreviewMaxSize
}
/* === Sending ============================================================== */
// Send partitions the given file into cMix message sized chunks and sends them
// via cmix.SendMany.
func
(
m
*
manager
)
Send
(
fileName
,
fileType
string
,
fileData
[]
byte
,
...
...
@@ -398,6 +400,8 @@ func (m *manager) CloseSend(tid *ftCrypto.TransferID) error {
return
nil
}
/* === Receiving ============================================================ */
// Receive concatenates the received file and returns it. Only returns the file
// if all file parts have been received and returns an error otherwise. Also
// deletes the transfer from storage. Once Receive has been called on a file, it
...
...
@@ -480,6 +484,8 @@ func (m *manager) registerReceivedProgressCallback(rt *store.ReceivedTransfer,
m
.
callbacks
.
AddCallback
(
rt
.
TransferID
(),
cb
,
period
)
}
/* === Utility ============================================================== */
// partitionFile splits the file into parts of the specified part size.
func
partitionFile
(
file
[]
byte
,
partSize
int
)
[][]
byte
{
// Initialize part list to the correct size
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment