本文整理汇总了Golang中github.com/aws/aws-sdk-go/aws.Int64Value函数的典型用法代码示例。如果您正苦于以下问题:Golang Int64Value函数的具体用法?Golang Int64Value怎么用?Golang Int64Value使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了Int64Value函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Golang代码示例。
示例1: TestRunTask
func TestRunTask(t *testing.T) {
mockEcs, _, client, ctrl := setupTestController(t, nil)
defer ctrl.Finish()
clusterName := "clusterName"
td := "taskDef"
startedBy := "startedBy"
count := 5
client.(*ecsClient).params = &config.CliParams{
Cluster: clusterName,
}
mockEcs.EXPECT().RunTask(gomock.Any()).Do(func(input interface{}) {
req := input.(*ecs.RunTaskInput)
if clusterName != aws.StringValue(req.Cluster) {
t.Errorf("clusterName should be [%s]. Got [%s]", clusterName, aws.StringValue(req.Cluster))
}
if td != aws.StringValue(req.TaskDefinition) {
t.Errorf("taskDefinition should be [%s]. Got [%s]", td, aws.StringValue(req.TaskDefinition))
}
if startedBy != aws.StringValue(req.StartedBy) {
t.Errorf("startedBy should be [%s]. Got [%s]", startedBy, aws.StringValue(req.StartedBy))
}
if int64(count) != aws.Int64Value(req.Count) {
t.Errorf("count should be [%s]. Got [%s]", count, aws.Int64Value(req.Count))
}
}).Return(&ecs.RunTaskOutput{}, nil)
_, err := client.RunTask(td, startedBy, count)
if err != nil {
t.Fatal(err)
}
}
开发者ID:uttarasridhar,项目名称:amazon-ecs-cli,代码行数:33,代码来源:client_test.go
示例2: waitForServiceTasks
// waitForServiceTasks continuously polls ECS (by calling describeService) and waits for service to get stable
// with desiredCount == runningCount
func waitForServiceTasks(service *Service, ecsServiceName string) error {
timeoutMessage := fmt.Sprintf("Timeout waiting for service %s to get stable", ecsServiceName)
return waitUntilComplete(func(retryCount int) (bool, error) {
ecsService, err := service.describeService()
if err != nil {
return false, err
}
desiredCount := aws.Int64Value(ecsService.DesiredCount)
runningCount := aws.Int64Value(ecsService.RunningCount)
logFields := log.Fields{
"serviceName": ecsServiceName,
"desiredCount": desiredCount,
"runningCount": runningCount,
}
if len(ecsService.Deployments) == 1 && desiredCount == runningCount {
log.WithFields(logFields).Info("ECS Service has reached a stable state")
return true, nil
}
if retryCount%2 == 0 {
log.WithFields(logFields).Info("Describe ECS Service status")
} else {
log.WithFields(logFields).Debug("Describe ECS Service status")
}
return false, nil
}, service, timeoutMessage, true)
}
开发者ID:jloper3,项目名称:amazon-ecs-cli,代码行数:33,代码来源:waiters.go
示例3: UpdateService
func (client *ecsClient) UpdateService(serviceName, taskDefinition string, count int64, deploymentConfig *ecs.DeploymentConfiguration) error {
input := &ecs.UpdateServiceInput{
DesiredCount: aws.Int64(count),
Service: aws.String(serviceName),
Cluster: aws.String(client.params.Cluster),
DeploymentConfiguration: deploymentConfig,
}
if taskDefinition != "" {
input.TaskDefinition = aws.String(taskDefinition)
}
_, err := client.client.UpdateService(input)
if err != nil {
log.WithFields(log.Fields{
"service": serviceName,
"error": err,
}).Error("Error updating service")
return err
}
fields := log.Fields{
"service": serviceName,
"count": count,
}
if taskDefinition != "" {
fields["taskDefinition"] = taskDefinition
}
if deploymentConfig != nil && deploymentConfig.MaximumPercent != nil {
fields["deployment-max-percent"] = aws.Int64Value(deploymentConfig.MaximumPercent)
}
if deploymentConfig != nil && deploymentConfig.MinimumHealthyPercent != nil {
fields["deployment-min-healthy-percent"] = aws.Int64Value(deploymentConfig.MinimumHealthyPercent)
}
log.WithFields(fields).Debug("Updated ECS service")
return nil
}
开发者ID:yinshiua,项目名称:amazon-ecs-cli,代码行数:34,代码来源:client.go
示例4: buildDBInstance
func (r *RDSDBInstance) buildDBInstance(dbInstance *rds.DBInstance) DBInstanceDetails {
dbInstanceDetails := DBInstanceDetails{
Identifier: aws.StringValue(dbInstance.DBInstanceIdentifier),
Status: aws.StringValue(dbInstance.DBInstanceStatus),
Engine: aws.StringValue(dbInstance.Engine),
EngineVersion: aws.StringValue(dbInstance.EngineVersion),
DBName: aws.StringValue(dbInstance.DBName),
MasterUsername: aws.StringValue(dbInstance.MasterUsername),
AllocatedStorage: aws.Int64Value(dbInstance.AllocatedStorage),
}
if dbInstance.Endpoint != nil {
dbInstanceDetails.Address = aws.StringValue(dbInstance.Endpoint.Address)
dbInstanceDetails.Port = aws.Int64Value(dbInstance.Endpoint.Port)
}
if dbInstance.PendingModifiedValues != nil {
emptyPendingModifiedValues := &rds.PendingModifiedValues{}
if *dbInstance.PendingModifiedValues != *emptyPendingModifiedValues {
dbInstanceDetails.PendingModifications = true
}
}
return dbInstanceDetails
}
开发者ID:x6j8x,项目名称:rds-broker,代码行数:25,代码来源:rds_db_instance.go
示例5: rootBlockDeviceToSet
func rootBlockDeviceToSet(
bdm []*ec2.BlockDeviceMapping,
rootDevName *string,
) *schema.Set {
set := &schema.Set{F: hashRootBlockDevice}
if rootDevName != nil {
for _, val := range bdm {
if aws.StringValue(val.DeviceName) == aws.StringValue(rootDevName) {
m := make(map[string]interface{})
if val.Ebs.DeleteOnTermination != nil {
m["delete_on_termination"] = aws.BoolValue(val.Ebs.DeleteOnTermination)
}
if val.Ebs.VolumeSize != nil {
m["volume_size"] = aws.Int64Value(val.Ebs.VolumeSize)
}
if val.Ebs.VolumeType != nil {
m["volume_type"] = aws.StringValue(val.Ebs.VolumeType)
}
if val.Ebs.Iops != nil {
m["iops"] = aws.Int64Value(val.Ebs.Iops)
}
set.Add(m)
}
}
}
return set
}
开发者ID:mhlias,项目名称:terraform,代码行数:33,代码来源:resource_aws_spot_fleet_request.go
示例6: CreateService
func (client *ecsClient) CreateService(serviceName, taskDefName string, deploymentConfig *ecs.DeploymentConfiguration) error {
_, err := client.client.CreateService(&ecs.CreateServiceInput{
DesiredCount: aws.Int64(0), // Required
ServiceName: aws.String(serviceName), // Required
TaskDefinition: aws.String(taskDefName), // Required
Cluster: aws.String(client.params.Cluster),
DeploymentConfiguration: deploymentConfig,
})
if err != nil {
log.WithFields(log.Fields{
"service": serviceName,
"error": err,
}).Error("Error creating service")
return err
}
fields := log.Fields{
"service": serviceName,
"taskDefinition": taskDefName,
}
if deploymentConfig != nil && deploymentConfig.MaximumPercent != nil {
fields["deployment-max-percent"] = aws.Int64Value(deploymentConfig.MaximumPercent)
}
if deploymentConfig != nil && deploymentConfig.MinimumHealthyPercent != nil {
fields["deployment-min-healthy-percent"] = aws.Int64Value(deploymentConfig.MinimumHealthyPercent)
}
log.WithFields(fields).Info("Created an ECS service")
return nil
}
开发者ID:yinshiua,项目名称:amazon-ecs-cli,代码行数:30,代码来源:client.go
示例7: TestLoadContext
func TestLoadContext(t *testing.T) {
deploymentMaxPercent := 150
flagSet := flag.NewFlagSet("ecs-cli-up", 0)
flagSet.String(DeploymentMaxPercentFlag, strconv.Itoa(deploymentMaxPercent), "")
cliContext := cli.NewContext(nil, flagSet, nil)
service := &Service{
projectContext: &Context{CLIContext: cliContext},
}
if err := service.LoadContext(); err != nil {
t.Fatal("Unexpected error while loading context in load context test")
}
observedDeploymentConfig := service.DeploymentConfig()
if aws.Int64Value(observedDeploymentConfig.MaximumPercent) != int64(deploymentMaxPercent) {
t.Errorf("Expected DeploymentConfig.MaxPercent to be [%s] but got [%s]",
deploymentMaxPercent, aws.Int64Value(observedDeploymentConfig.MaximumPercent))
}
if observedDeploymentConfig.MinimumHealthyPercent != nil {
t.Errorf("Expected DeploymentConfig.MinimumHealthyPercent to be nil but got [%s]",
aws.Int64Value(observedDeploymentConfig.MinimumHealthyPercent))
}
}
开发者ID:uttarasridhar,项目名称:amazon-ecs-cli,代码行数:25,代码来源:service_test.go
示例8: Marshal
// Marshal parses the response from the aws sdk into an awsm ScalingPolicy
func (s *ScalingPolicy) Marshal(policy *autoscaling.ScalingPolicy, region string) {
adjustment := int(aws.Int64Value(policy.ScalingAdjustment))
adjustmentStr := fmt.Sprint(adjustment)
if adjustment >= 1 {
adjustmentStr = fmt.Sprintf("+%d", adjustment)
}
var alarmArns []string
var alarmNames []string
for _, alarm := range policy.Alarms {
arnStr := aws.StringValue(alarm.AlarmARN)
alarmArns = append(alarmArns, arnStr)
arn, err := ParseArn(arnStr)
if err == nil {
alarmNames = append(alarmNames, arn.Resource)
} else {
alarmNames = append(alarmNames, "?????")
}
}
s.Name = aws.StringValue(policy.PolicyName)
s.Arn = aws.StringValue(policy.PolicyARN)
s.AdjustmentType = aws.StringValue(policy.AdjustmentType)
s.Adjustment = adjustment
s.AdjustmentStr = adjustmentStr
s.Cooldown = fmt.Sprint(aws.Int64Value(policy.Cooldown))
s.AutoScaleGroupName = aws.StringValue(policy.AutoScalingGroupName)
s.AlarmArns = alarmArns
s.AlarmNames = strings.Join(alarmNames, ", ")
s.Region = region
}
开发者ID:murdinc,项目名称:awsm,代码行数:35,代码来源:scalingpolicies.go
示例9: Find
func (e *LoadBalancer) Find(c *fi.Context) (*LoadBalancer, error) {
cloud := c.Cloud.(*awsup.AWSCloud)
elbName := fi.StringValue(e.ID)
if elbName == "" {
elbName = fi.StringValue(e.Name)
}
lb, err := findELB(cloud, elbName)
if err != nil {
return nil, err
}
if lb == nil {
return nil, nil
}
actual := &LoadBalancer{}
actual.Name = e.Name
actual.ID = lb.LoadBalancerName
actual.DNSName = lb.DNSName
actual.HostedZoneId = lb.CanonicalHostedZoneNameID
for _, subnet := range lb.Subnets {
actual.Subnets = append(actual.Subnets, &Subnet{ID: subnet})
}
for _, sg := range lb.SecurityGroups {
actual.SecurityGroups = append(actual.SecurityGroups, &SecurityGroup{ID: sg})
}
actual.Listeners = make(map[string]*LoadBalancerListener)
for _, ld := range lb.ListenerDescriptions {
l := ld.Listener
loadBalancerPort := strconv.FormatInt(aws.Int64Value(l.LoadBalancerPort), 10)
actualListener := &LoadBalancerListener{}
actualListener.InstancePort = int(aws.Int64Value(l.InstancePort))
actual.Listeners[loadBalancerPort] = actualListener
}
// Avoid spurious mismatches
if subnetSlicesEqualIgnoreOrder(actual.Subnets, e.Subnets) {
actual.Subnets = e.Subnets
}
if e.DNSName == nil {
e.DNSName = actual.DNSName
}
if e.HostedZoneId == nil {
e.HostedZoneId = actual.HostedZoneId
}
if e.ID == nil {
e.ID = actual.ID
}
return actual, nil
}
开发者ID:crohling,项目名称:kops,代码行数:56,代码来源:load_balancer.go
示例10: Marshal
// Marshal parses the response from the aws sdk into an awsm Alarm
func (a *Alarm) Marshal(alarm *cloudwatch.MetricAlarm, region string) {
var dimensions []string
var operator string
for _, dim := range alarm.Dimensions {
dimensions = append(dimensions, aws.StringValue(dim.Name)+" = "+aws.StringValue(dim.Value))
}
switch aws.StringValue(alarm.ComparisonOperator) {
case "GreaterThanThreshold":
operator = ">"
case "GreaterThanOrEqualToThreshold":
operator = ">="
case "LessThanThreshold":
operator = "<"
case "LessThanOrEqualToThreshold":
operator = "<="
}
var actionArns []string
var actionNames []string
for _, action := range alarm.AlarmActions {
arnStr := aws.StringValue(action)
actionArns = append(actionArns, arnStr)
arn, err := ParseArn(arnStr)
if err == nil {
actionNames = append(actionNames, arn.PolicyName)
} else {
actionNames = append(actionNames, "??????")
}
}
a.Name = aws.StringValue(alarm.AlarmName)
a.Arn = aws.StringValue(alarm.AlarmArn)
a.Description = aws.StringValue(alarm.AlarmDescription)
a.State = aws.StringValue(alarm.StateValue)
a.Trigger = fmt.Sprintf("%s %s %d (%s)", aws.StringValue(alarm.MetricName), operator, int(aws.Float64Value(alarm.Threshold)), aws.StringValue(alarm.Statistic))
a.Period = fmt.Sprint(aws.Int64Value(alarm.Period))
a.EvalPeriods = fmt.Sprint(aws.Int64Value(alarm.EvaluationPeriods))
a.ActionArns = actionArns
a.ActionNames = strings.Join(actionNames, ", ")
a.Dimensions = strings.Join(dimensions, ", ")
a.Namespace = aws.StringValue(alarm.Namespace)
a.Region = region
}
开发者ID:murdinc,项目名称:awsm,代码行数:51,代码来源:alarms.go
示例11: buildDBCluster
func (r *RDSDBCluster) buildDBCluster(dbCluster *rds.DBCluster) DBClusterDetails {
dbClusterDetails := DBClusterDetails{
Identifier: aws.StringValue(dbCluster.DBClusterIdentifier),
Status: aws.StringValue(dbCluster.Status),
Engine: aws.StringValue(dbCluster.Engine),
EngineVersion: aws.StringValue(dbCluster.EngineVersion),
DatabaseName: aws.StringValue(dbCluster.DatabaseName),
MasterUsername: aws.StringValue(dbCluster.MasterUsername),
AllocatedStorage: aws.Int64Value(dbCluster.AllocatedStorage),
Endpoint: aws.StringValue(dbCluster.Endpoint),
Port: aws.Int64Value(dbCluster.Port),
}
return dbClusterDetails
}
开发者ID:x6j8x,项目名称:rds-broker,代码行数:15,代码来源:rds_db_cluster.go
示例12: buildStackDetails
func (s *CloudFormationStack) buildStackDetails(stack *cloudformation.Stack) StackDetails {
stackDetails := StackDetails{
StackName: aws.StringValue(stack.StackName),
Capabilities: aws.StringValueSlice(stack.Capabilities),
DisableRollback: aws.BoolValue(stack.DisableRollback),
Description: aws.StringValue(stack.Description),
NotificationARNs: aws.StringValueSlice(stack.NotificationARNs),
StackID: aws.StringValue(stack.StackId),
StackStatus: s.stackStatus(aws.StringValue(stack.StackStatus)),
TimeoutInMinutes: aws.Int64Value(stack.TimeoutInMinutes),
}
if stack.Parameters != nil && len(stack.Parameters) > 0 {
stackDetails.Parameters = make(map[string]string)
for _, parameter := range stack.Parameters {
stackDetails.Parameters[aws.StringValue(parameter.ParameterKey)] = aws.StringValue(parameter.ParameterValue)
}
}
if stack.Outputs != nil && len(stack.Outputs) > 0 {
stackDetails.Outputs = make(map[string]string)
for _, output := range stack.Outputs {
stackDetails.Outputs[aws.StringValue(output.OutputKey)] = aws.StringValue(output.OutputValue)
}
}
return stackDetails
}
开发者ID:cf-platform-eng,项目名称:cloudformation-broker,代码行数:28,代码来源:cf_stack.go
示例13: SizeFromVolumeId
// Size returns the given volume ids size. Returns 0 if the size is not
// available
func (v Volumes) SizeFromVolumeId(id string) int {
vol, ok := v[id]
if !ok {
return 0
}
return int(aws.Int64Value(vol.Size))
}
开发者ID:koding,项目名称:koding,代码行数:9,代码来源:volumes.go
示例14: Down
// Down stops any running containers(tasks) by calling Stop() and deletes an active ECS Service
// NoOp if the service is inactive
func (s *Service) Down() error {
// describe the service
ecsService, err := s.describeService()
if err != nil {
return err
}
ecsServiceName := aws.StringValue(ecsService.ServiceName)
// if already deleted, NoOp
if aws.StringValue(ecsService.Status) != ecsActiveResourceCode {
log.WithFields(log.Fields{
"serviceName": ecsServiceName,
}).Info("ECS Service is already deleted")
return nil
}
// stop any running tasks
if aws.Int64Value(ecsService.DesiredCount) != 0 {
if err = s.Stop(); err != nil {
return err
}
}
// deleteService
if err = s.Context().ECSClient.DeleteService(ecsServiceName); err != nil {
return err
}
return waitForServiceTasks(s, ecsServiceName)
}
开发者ID:jloper3,项目名称:amazon-ecs-cli,代码行数:31,代码来源:service.go
示例15: CheckDataAndGetSize
func (s3 *s3driver) CheckDataAndGetSize(dpconn, itemlocation, fileName string) (exist bool, size int64, err error) {
bucket := getAwsInfoFromDpconn(dpconn)
destFullPathFileName := bucket + "/" + itemlocation + "/" + fileName
log.Info(destFullPathFileName)
AWS_REGION = Env("AWS_REGION", false)
svc := s3aws.New(session.New(&aws.Config{Region: aws.String(AWS_REGION)}))
result, err := svc.ListObjects(&s3aws.ListObjectsInput{Bucket: aws.String(bucket),
Prefix: aws.String(itemlocation + "/" + fileName)})
if err != nil {
log.Error("Failed to list objects", err)
return exist, size, err
}
exist = false
for _, v := range result.Contents {
log.Infof("Tag:%s, key:%s, size:%v\n", aws.StringValue(v.ETag), aws.StringValue(v.Key), aws.Int64Value(v.Size))
if aws.StringValue(v.Key) == fileName {
size = aws.Int64Value(v.Size)
exist = true
}
}
return
}
开发者ID:asiainfoLDP,项目名称:datahub,代码行数:27,代码来源:s3driver.go
示例16: ebsBlockDevicesToSet
func ebsBlockDevicesToSet(bdm []*ec2.BlockDeviceMapping, rootDevName *string) *schema.Set {
set := &schema.Set{F: hashEphemeralBlockDevice}
for _, val := range bdm {
if val.Ebs != nil {
m := make(map[string]interface{})
ebs := val.Ebs
if val.DeviceName != nil {
if aws.StringValue(rootDevName) == aws.StringValue(val.DeviceName) {
continue
}
m["device_name"] = aws.StringValue(val.DeviceName)
}
if ebs.DeleteOnTermination != nil {
m["delete_on_termination"] = aws.BoolValue(ebs.DeleteOnTermination)
}
if ebs.SnapshotId != nil {
m["snapshot_id"] = aws.StringValue(ebs.SnapshotId)
}
if ebs.Encrypted != nil {
m["encrypted"] = aws.BoolValue(ebs.Encrypted)
}
if ebs.VolumeSize != nil {
m["volume_size"] = aws.Int64Value(ebs.VolumeSize)
}
if ebs.VolumeType != nil {
m["volume_type"] = aws.StringValue(ebs.VolumeType)
}
if ebs.Iops != nil {
m["iops"] = aws.Int64Value(ebs.Iops)
}
set.Add(m)
}
}
return set
}
开发者ID:mhlias,项目名称:terraform,代码行数:47,代码来源:resource_aws_spot_fleet_request.go
示例17: Marshal
// Marshal parses the response from the aws sdk into an awsm Security Group
func (s *SecurityGroup) Marshal(securitygroup *ec2.SecurityGroup, region string, vpcList *Vpcs) {
vpc := vpcList.GetVpcName(aws.StringValue(securitygroup.VpcId))
s.Name = aws.StringValue(securitygroup.GroupName)
s.Class = GetTagValue("Class", securitygroup.Tags)
s.GroupID = aws.StringValue(securitygroup.GroupId)
s.Description = aws.StringValue(securitygroup.Description)
s.Vpc = vpc
s.VpcID = aws.StringValue(securitygroup.VpcId)
s.Region = region
// Get the ingress grants
for _, grant := range securitygroup.IpPermissions {
var cidr []string
for _, ipRange := range grant.IpRanges {
cidr = append(cidr, aws.StringValue(ipRange.CidrIp))
}
s.SecurityGroupGrants = append(s.SecurityGroupGrants, config.SecurityGroupGrant{
Type: "ingress",
FromPort: int(aws.Int64Value(grant.FromPort)),
ToPort: int(aws.Int64Value(grant.ToPort)),
IPProtocol: aws.StringValue(grant.IpProtocol),
CidrIP: cidr,
})
}
// Get the egress grants
for _, grant := range securitygroup.IpPermissionsEgress {
var cidr []string
for _, ipRange := range grant.IpRanges {
cidr = append(cidr, aws.StringValue(ipRange.CidrIp))
}
s.SecurityGroupGrants = append(s.SecurityGroupGrants, config.SecurityGroupGrant{
Type: "egress",
FromPort: int(aws.Int64Value(grant.FromPort)),
ToPort: int(aws.Int64Value(grant.ToPort)),
IPProtocol: aws.StringValue(grant.IpProtocol),
CidrIP: cidr,
})
}
}
开发者ID:murdinc,项目名称:awsm,代码行数:48,代码来源:securitygroups.go
示例18: Up
// Up creates the task definition and service and starts the containers if necessary.
// It does so by calling DescribeService to see if its present, else's calls Create() and Start()
// If the compose file had changed, it would update the service with the new task definition
// by calling UpdateService with the new task definition
func (s *Service) Up() error {
// describe service to get the task definition and count running
ecsService, err := s.describeService()
var missingServiceErr bool
if err != nil {
if strings.Contains(err.Error(), ecsMissingResourceCode) {
missingServiceErr = true
} else {
return err
}
}
// get the current snapshot of compose yml
// and update this instance with the latest task definition
newTaskDefinition, err := getOrCreateTaskDefinition(s)
if err != nil {
return err
}
// if ECS service was not created before, or is inactive, create and start the ECS Service
if missingServiceErr || aws.StringValue(ecsService.Status) != ecsActiveResourceCode {
// uses the latest task definition to create the service
err = s.createService()
if err != nil {
return err
}
return s.Start()
}
oldTaskDefinitionId := getIdFromArn(ecsService.TaskDefinition)
newTaskDefinitionId := getIdFromArn(newTaskDefinition.TaskDefinitionArn)
oldCount := aws.Int64Value(ecsService.DesiredCount)
newCount := int64(1)
if oldCount != 0 {
newCount = oldCount // get the current non-zero count
}
// if both the task definitions are the same, just start the service
if oldTaskDefinitionId == newTaskDefinitionId {
return s.startService(ecsService)
}
ecsServiceName := aws.StringValue(ecsService.ServiceName)
// if the task definitions were different, updateService with new task definition
// this creates a deployment in ECS and slowly takes down the containers with old ones and starts new ones
err = s.Context().ECSClient.UpdateService(ecsServiceName, newTaskDefinitionId, newCount)
if err != nil {
return err
}
log.WithFields(log.Fields{
"serviceName": ecsServiceName,
"taskDefinition": newTaskDefinitionId,
"desiredCount": newCount,
}).Info("Updated the ECS service with a new task definition. " +
"Old containers will be stopped automatically, and replaced with new ones")
return waitForServiceTasks(s, ecsServiceName)
}
开发者ID:jloper3,项目名称:amazon-ecs-cli,代码行数:63,代码来源:service.go
示例19: start
func (d *dumper) start(infoWriter io.Writer) (done chan error, err error) {
out := d.openWriters()
w := dyndump.NewSimpleEncoder(out)
fmt.Fprintf(infoWriter, "Beginning scan: table=%q readCapacity=%d parallel=%d itemCount=%d totalSize=%s\n",
*d.tableName, *d.readCapacity, *d.parallel,
aws.Int64Value(d.tableInfo.ItemCount), fmtBytes(aws.Int64Value(d.tableInfo.TableSizeBytes)))
d.f = &dyndump.Fetcher{
Dyn: d.dyn,
TableName: *d.tableName,
ConsistentRead: *d.consistentRead,
MaxParallel: *d.parallel,
MaxItems: int64(*d.maxItems),
ReadCapacity: float64(*d.readCapacity),
Writer: w,
}
done = make(chan error)
d.abortChan = make(chan struct{}, 1)
d.startTime = time.Now()
go func() {
rerr := make(chan error)
go func() { rerr <- d.f.Run() }()
select {
case <-d.abortChan:
d.f.Stop()
<-rerr
out.Abort()
done <- errors.New("Aborted")
case err := <-rerr:
if err != nil {
out.Abort()
done <- err
} else {
done <- out.Close()
}
}
}()
return done, nil
}
开发者ID:gwatts,项目名称:dyndump,代码行数:45,代码来源:cmd_dump.go
示例20: LookUpInodeMaybeDir
// returned inode has nil Id
func (fs *Goofys) LookUpInodeMaybeDir(name string, fullName string) (inode *Inode, err error) {
errObjectChan := make(chan error, 1)
objectChan := make(chan s3.HeadObjectOutput, 1)
errDirChan := make(chan error, 1)
dirChan := make(chan s3.ListObjectsOutput, 1)
go fs.LookUpInodeNotDir(fullName, objectChan, errObjectChan)
go fs.LookUpInodeDir(fullName, dirChan, errDirChan)
notFound := false
for {
select {
case resp := <-objectChan:
// XXX/TODO if both object and object/ exists, return dir
inode = NewInode(&name, &fullName, fs.flags)
inode.Attributes = &fuseops.InodeAttributes{
Size: uint64(aws.Int64Value(resp.ContentLength)),
Nlink: 1,
Mode: fs.flags.FileMode,
Atime: *resp.LastModified,
Mtime: *resp.LastModified,
Ctime: *resp.LastModified,
Crtime: *resp.LastModified,
Uid: fs.flags.Uid,
Gid: fs.flags.Gid,
}
return
case err = <-errObjectChan:
if err == fuse.ENOENT {
if notFound {
return nil, err
} else {
notFound = true
err = nil
}
} else {
return
}
case resp := <-dirChan:
if len(resp.CommonPrefixes) != 0 || len(resp.Contents) != 0 {
inode = NewInode(&name, &fullName, fs.flags)
inode.Attributes = &fs.rootAttrs
return
} else {
// 404
if notFound {
return nil, fuse.ENOENT
} else {
notFound = true
}
}
case err = <-errDirChan:
return
}
}
}
开发者ID:x5u,项目名称:goofys,代码行数:58,代码来源:goofys.go
注:本文中的github.com/aws/aws-sdk-go/aws.Int64Value函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论