Skip to content

Commit 4f11ac7

Browse files
authored
Merge pull request #91 from xibz/ifaces
Adding machine interface
2 parents 5ac6d3f + c1642f7 commit 4f11ac7

File tree

6 files changed

+84
-5
lines changed

6 files changed

+84
-5
lines changed

client_transports.go

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,16 @@
1+
// Copyright 2018-2019 Amazon.com, Inc. or its affiliates. All Rights Reserved.
2+
//
3+
// Licensed under the Apache License, Version 2.0 (the "License"). You may
4+
// not use this file except in compliance with the License. A copy of the
5+
// License is located at
6+
//
7+
// http://aws.amazon.com/apache2.0/
8+
//
9+
// or in the "license" file accompanying this file. This file is distributed
10+
// on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
11+
// express or implied. See the License for the specific language governing
12+
// permissions and limitations under the License.
13+
114
package firecracker
215

316
import (

client_transports_test.go

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,16 @@
1+
// Copyright 2018-2019 Amazon.com, Inc. or its affiliates. All Rights Reserved.
2+
//
3+
// Licensed under the Apache License, Version 2.0 (the "License"). You may
4+
// not use this file except in compliance with the License. A copy of the
5+
// License is located at
6+
//
7+
// http://aws.amazon.com/apache2.0/
8+
//
9+
// or in the "license" file accompanying this file. This file is distributed
10+
// on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
11+
// express or implied. See the License for the specific language governing
12+
// permissions and limitations under the License.
13+
114
package firecracker
215

316
import (

machine.go

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -597,11 +597,6 @@ func (m *Machine) sendCtrlAltDel(ctx context.Context) error {
597597
return err
598598
}
599599

600-
// EnableMetadata will append or replace the metadata handler.
601-
func (m *Machine) EnableMetadata(metadata interface{}) {
602-
m.Handlers.FcInit = m.Handlers.FcInit.Swappend(NewSetMetadataHandler(metadata))
603-
}
604-
605600
// SetMetadata sets the machine's metadata for MDDS
606601
func (m *Machine) SetMetadata(ctx context.Context, metadata interface{}) error {
607602
if _, err := m.client.PutMmds(ctx, metadata); err != nil {

machineiface.go

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
// Copyright 2018-2019 Amazon.com, Inc. or its affiliates. All Rights Reserved.
2+
//
3+
// Licensed under the Apache License, Version 2.0 (the "License"). You may
4+
// not use this file except in compliance with the License. A copy of the
5+
// License is located at
6+
//
7+
// http://aws.amazon.com/apache2.0/
8+
//
9+
// or in the "license" file accompanying this file. This file is distributed
10+
// on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
11+
// express or implied. See the License for the specific language governing
12+
// permissions and limitations under the License.
13+
14+
package firecracker
15+
16+
import (
17+
"context"
18+
)
19+
20+
// This ensures the interface method signatures match that of Machine
21+
var _ MachineIface = (*Machine)(nil)
22+
23+
// MachineIface can be used for mocking and testing of the Machine. The Machine
24+
// is subject to change, meaning this interface would change.
25+
type MachineIface interface {
26+
Start(context.Context) error
27+
StopVMM() error
28+
Shutdown(context.Context) error
29+
Wait(context.Context) error
30+
SetMetadata(context.Context, interface{}) error
31+
UpdateGuestDrive(context.Context, string, string, ...PatchGuestDriveByIDOpt) error
32+
}

rate_limiter.go

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,16 @@
1+
// Copyright 2018-2019 Amazon.com, Inc. or its affiliates. All Rights Reserved.
2+
//
3+
// Licensed under the Apache License, Version 2.0 (the "License"). You may
4+
// not use this file except in compliance with the License. A copy of the
5+
// License is located at
6+
//
7+
// http://aws.amazon.com/apache2.0/
8+
//
9+
// or in the "license" file accompanying this file. This file is distributed
10+
// on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
11+
// express or implied. See the License for the specific language governing
12+
// permissions and limitations under the License.
13+
114
package firecracker
215

316
import (

rate_limiter_test.go

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,16 @@
1+
// Copyright 2018-2019 Amazon.com, Inc. or its affiliates. All Rights Reserved.
2+
//
3+
// Licensed under the Apache License, Version 2.0 (the "License"). You may
4+
// not use this file except in compliance with the License. A copy of the
5+
// License is located at
6+
//
7+
// http://aws.amazon.com/apache2.0/
8+
//
9+
// or in the "license" file accompanying this file. This file is distributed
10+
// on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
11+
// express or implied. See the License for the specific language governing
12+
// permissions and limitations under the License.
13+
114
package firecracker_test
215

316
import (

0 commit comments

Comments
 (0)