Skip to content
Projeler
Gruplar
Parçacıklar
Yardım
Yükleniyor...
Oturum aç / Kaydol
Gezinmeyi değiştir
D
docker-py
Proje
Proje
Ayrıntılar
Etkinlik
Cycle Analytics
Depo (repository)
Depo (repository)
Dosyalar
Kayıtlar (commit)
Dallar (branch)
Etiketler
Katkıda bulunanlar
Grafik
Karşılaştır
Grafikler
Konular (issue)
0
Konular (issue)
0
Liste
Pano
Etiketler
Kilometre Taşları
Birleştirme (merge) Talepleri
0
Birleştirme (merge) Talepleri
0
CI / CD
CI / CD
İş akışları (pipeline)
İşler
Zamanlamalar
Grafikler
Paketler
Paketler
Wiki
Wiki
Parçacıklar
Parçacıklar
Üyeler
Üyeler
Collapse sidebar
Close sidebar
Etkinlik
Grafik
Grafikler
Yeni bir konu (issue) oluştur
İşler
Kayıtlar (commit)
Konu (issue) Panoları
Kenar çubuğunu aç
Batuhan Osman TASKAYA
docker-py
Commits
941b3054
Kaydet (Commit)
941b3054
authored
Kas 15, 2018
tarafından
Joffrey F
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
WIP
Signed-off-by:
Joffrey F
<
joffrey@docker.com
>
üst
e3da30a0
Hide whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
553 additions
and
20 deletions
+553
-20
auth.proto
docker/api/buildkit/auth/auth.proto
+20
-0
auth.py
docker/api/buildkit/auth/auth.py
+26
-0
auth_grpc.py
docker/api/buildkit/auth/auth_grpc.py
+37
-0
auth_pb2.py
docker/api/buildkit/auth/auth_pb2.py
+140
-0
filesync.proto
docker/api/buildkit/filesync/filesync.proto
+21
-0
filesync.py
docker/api/buildkit/filesync/filesync.py
+22
-0
filesync_grpc.py
docker/api/buildkit/filesync/filesync_grpc.py
+81
-0
filesync_pb2.py
docker/api/buildkit/filesync/filesync_pb2.py
+127
-0
grpc.py
docker/api/buildkit/grpc.py
+33
-0
session.py
docker/api/buildkit/session.py
+34
-20
daemon.py
docker/api/daemon.py
+12
-0
No files found.
docker/api/buildkit/auth/auth.proto
0 → 100644
Dosyayı görüntüle @
941b3054
syntax
=
"proto3"
;
package
moby
.
filesync.v1
;
option
go_package
=
"auth"
;
service
Auth
{
rpc
Credentials
(
CredentialsRequest
)
returns
(
CredentialsResponse
);
}
message
CredentialsRequest
{
string
Host
=
1
;
}
message
CredentialsResponse
{
string
Username
=
1
;
string
Secret
=
2
;
}
\ No newline at end of file
docker/api/buildkit/auth/auth.py
0 → 100644
Dosyayı görüntüle @
941b3054
from
.auth_pb2
import
CredentialsResponse
from
.auth_grpc
import
AuthBase
from
..grpc
import
Attachable
from
docker.auth
import
resolve_authconfig
class
Auth
(
AuthBase
,
Attachable
):
def
__init__
(
self
,
authconfig
,
credstore_env
,
*
args
,
**
kwargs
):
self
.
authconfig
=
authconfig
self
.
credstore_env
=
credstore_env
super
(
Auth
,
self
)
.
__init__
(
*
args
,
**
kwargs
)
async
def
Credentials
(
self
,
stream
):
request
=
await
stream
.
recv_message
()
host
=
request
.
Host
auth_data
=
resolve_authconfig
(
self
.
authconfig
,
host
,
self
.
credstore_env
)
response
=
None
if
auth_data
is
None
:
response
=
CredentialsResponse
(
Username
=
None
,
Secret
=
None
)
else
:
response
=
CredentialsResponse
(
Username
=
auth_data
[
'Username'
],
Secret
=
auth_data
[
'Password'
]
)
await
stream
.
send_message
(
response
)
docker/api/buildkit/auth/auth_grpc.py
0 → 100644
Dosyayı görüntüle @
941b3054
# Generated by the Protocol Buffers compiler. DO NOT EDIT!
# source: auth.proto
# plugin: grpclib.plugin.main
import
abc
import
grpclib.const
import
grpclib.client
import
auth_pb2
class
AuthBase
(
abc
.
ABC
):
@abc.abstractmethod
async
def
Credentials
(
self
,
stream
):
pass
def
__mapping__
(
self
):
return
{
'/moby.filesync.v1.Auth/Credentials'
:
grpclib
.
const
.
Handler
(
self
.
Credentials
,
grpclib
.
const
.
Cardinality
.
UNARY_UNARY
,
auth_pb2
.
CredentialsRequest
,
auth_pb2
.
CredentialsResponse
,
),
}
class
AuthStub
:
def
__init__
(
self
,
channel
:
grpclib
.
client
.
Channel
)
->
None
:
self
.
Credentials
=
grpclib
.
client
.
UnaryUnaryMethod
(
channel
,
'/moby.filesync.v1.Auth/Credentials'
,
auth_pb2
.
CredentialsRequest
,
auth_pb2
.
CredentialsResponse
,
)
docker/api/buildkit/auth/auth_pb2.py
0 → 100644
Dosyayı görüntüle @
941b3054
# Generated by the protocol buffer compiler. DO NOT EDIT!
# source: auth.proto
import
sys
_b
=
sys
.
version_info
[
0
]
<
3
and
(
lambda
x
:
x
)
or
(
lambda
x
:
x
.
encode
(
'latin1'
))
from
google.protobuf
import
descriptor
as
_descriptor
from
google.protobuf
import
message
as
_message
from
google.protobuf
import
reflection
as
_reflection
from
google.protobuf
import
symbol_database
as
_symbol_database
# @@protoc_insertion_point(imports)
_sym_db
=
_symbol_database
.
Default
()
DESCRIPTOR
=
_descriptor
.
FileDescriptor
(
name
=
'auth.proto'
,
package
=
'moby.filesync.v1'
,
syntax
=
'proto3'
,
serialized_options
=
_b
(
'Z
\004
auth'
),
serialized_pb
=
_b
(
'
\n\n
auth.proto
\x12\x10
moby.filesync.v1
\"\"\n\x12\x43
redentialsRequest
\x12\x0c\n\x04
Host
\x18\x01
\x01
(
\t\"
7
\n\x13\x43
redentialsResponse
\x12\x10\n\x08
Username
\x18\x01
\x01
(
\t\x12\x0e\n\x06
Secret
\x18\x02
\x01
(
\t
2b
\n\x04\x41
uth
\x12
Z
\n\x0b\x43
redentials
\x12
$.moby.filesync.v1.CredentialsRequest
\x1a
%
.moby.filesync.v1.CredentialsResponseB
\x06
Z
\x04\x61
uthb
\x06
proto3'
)
)
_CREDENTIALSREQUEST
=
_descriptor
.
Descriptor
(
name
=
'CredentialsRequest'
,
full_name
=
'moby.filesync.v1.CredentialsRequest'
,
filename
=
None
,
file
=
DESCRIPTOR
,
containing_type
=
None
,
fields
=
[
_descriptor
.
FieldDescriptor
(
name
=
'Host'
,
full_name
=
'moby.filesync.v1.CredentialsRequest.Host'
,
index
=
0
,
number
=
1
,
type
=
9
,
cpp_type
=
9
,
label
=
1
,
has_default_value
=
False
,
default_value
=
_b
(
""
)
.
decode
(
'utf-8'
),
message_type
=
None
,
enum_type
=
None
,
containing_type
=
None
,
is_extension
=
False
,
extension_scope
=
None
,
serialized_options
=
None
,
file
=
DESCRIPTOR
),
],
extensions
=
[
],
nested_types
=
[],
enum_types
=
[
],
serialized_options
=
None
,
is_extendable
=
False
,
syntax
=
'proto3'
,
extension_ranges
=
[],
oneofs
=
[
],
serialized_start
=
32
,
serialized_end
=
66
,
)
_CREDENTIALSRESPONSE
=
_descriptor
.
Descriptor
(
name
=
'CredentialsResponse'
,
full_name
=
'moby.filesync.v1.CredentialsResponse'
,
filename
=
None
,
file
=
DESCRIPTOR
,
containing_type
=
None
,
fields
=
[
_descriptor
.
FieldDescriptor
(
name
=
'Username'
,
full_name
=
'moby.filesync.v1.CredentialsResponse.Username'
,
index
=
0
,
number
=
1
,
type
=
9
,
cpp_type
=
9
,
label
=
1
,
has_default_value
=
False
,
default_value
=
_b
(
""
)
.
decode
(
'utf-8'
),
message_type
=
None
,
enum_type
=
None
,
containing_type
=
None
,
is_extension
=
False
,
extension_scope
=
None
,
serialized_options
=
None
,
file
=
DESCRIPTOR
),
_descriptor
.
FieldDescriptor
(
name
=
'Secret'
,
full_name
=
'moby.filesync.v1.CredentialsResponse.Secret'
,
index
=
1
,
number
=
2
,
type
=
9
,
cpp_type
=
9
,
label
=
1
,
has_default_value
=
False
,
default_value
=
_b
(
""
)
.
decode
(
'utf-8'
),
message_type
=
None
,
enum_type
=
None
,
containing_type
=
None
,
is_extension
=
False
,
extension_scope
=
None
,
serialized_options
=
None
,
file
=
DESCRIPTOR
),
],
extensions
=
[
],
nested_types
=
[],
enum_types
=
[
],
serialized_options
=
None
,
is_extendable
=
False
,
syntax
=
'proto3'
,
extension_ranges
=
[],
oneofs
=
[
],
serialized_start
=
68
,
serialized_end
=
123
,
)
DESCRIPTOR
.
message_types_by_name
[
'CredentialsRequest'
]
=
_CREDENTIALSREQUEST
DESCRIPTOR
.
message_types_by_name
[
'CredentialsResponse'
]
=
_CREDENTIALSRESPONSE
_sym_db
.
RegisterFileDescriptor
(
DESCRIPTOR
)
CredentialsRequest
=
_reflection
.
GeneratedProtocolMessageType
(
'CredentialsRequest'
,
(
_message
.
Message
,),
dict
(
DESCRIPTOR
=
_CREDENTIALSREQUEST
,
__module__
=
'auth_pb2'
# @@protoc_insertion_point(class_scope:moby.filesync.v1.CredentialsRequest)
))
_sym_db
.
RegisterMessage
(
CredentialsRequest
)
CredentialsResponse
=
_reflection
.
GeneratedProtocolMessageType
(
'CredentialsResponse'
,
(
_message
.
Message
,),
dict
(
DESCRIPTOR
=
_CREDENTIALSRESPONSE
,
__module__
=
'auth_pb2'
# @@protoc_insertion_point(class_scope:moby.filesync.v1.CredentialsResponse)
))
_sym_db
.
RegisterMessage
(
CredentialsResponse
)
DESCRIPTOR
.
_options
=
None
_AUTH
=
_descriptor
.
ServiceDescriptor
(
name
=
'Auth'
,
full_name
=
'moby.filesync.v1.Auth'
,
file
=
DESCRIPTOR
,
index
=
0
,
serialized_options
=
None
,
serialized_start
=
125
,
serialized_end
=
223
,
methods
=
[
_descriptor
.
MethodDescriptor
(
name
=
'Credentials'
,
full_name
=
'moby.filesync.v1.Auth.Credentials'
,
index
=
0
,
containing_service
=
None
,
input_type
=
_CREDENTIALSREQUEST
,
output_type
=
_CREDENTIALSRESPONSE
,
serialized_options
=
None
,
),
])
_sym_db
.
RegisterServiceDescriptor
(
_AUTH
)
DESCRIPTOR
.
services_by_name
[
'Auth'
]
=
_AUTH
# @@protoc_insertion_point(module_scope)
docker/api/buildkit/filesync/filesync.proto
0 → 100644
Dosyayı görüntüle @
941b3054
syntax
=
"proto3"
;
package
moby
.
filesync.v1
;
option
go_package
=
"filesync"
;
service
FileSync
{
rpc
DiffCopy
(
stream
BytesMessage
)
returns
(
stream
BytesMessage
);
rpc
TarStream
(
stream
BytesMessage
)
returns
(
stream
BytesMessage
);
}
service
FileSend
{
rpc
DiffCopy
(
stream
BytesMessage
)
returns
(
stream
BytesMessage
);
}
// BytesMessage contains a chunk of byte data
message
BytesMessage
{
bytes
data
=
1
;
}
\ No newline at end of file
docker/api/buildkit/filesync/filesync.py
0 → 100644
Dosyayı görüntüle @
941b3054
from
.filesync_pb2
import
BytesMessage
from
.filesync_grpc
import
FileSendBase
,
FileSyncBase
from
..grpc
import
Attachable
class
FileSync
(
FileSyncBase
,
Attachable
):
def
__init__
(
self
,
*
args
,
**
kwargs
):
super
(
FileSync
,
self
)
.
__init__
(
*
args
,
**
kwargs
)
async
def
DiffCopy
(
self
,
stream
):
pass
async
def
TarStream
(
self
,
stream
):
pass
class
FileSend
(
FileSendBase
,
Attachable
):
def
__init__
(
self
,
*
args
,
**
kwargs
):
super
(
FileSync
,
self
)
.
__init__
(
*
args
,
**
kwargs
)
async
def
DiffCopy
(
self
,
stream
):
pass
docker/api/buildkit/filesync/filesync_grpc.py
0 → 100644
Dosyayı görüntüle @
941b3054
# Generated by the Protocol Buffers compiler. DO NOT EDIT!
# source: filesync.proto
# plugin: grpclib.plugin.main
import
abc
import
grpclib.const
import
grpclib.client
import
filesync_pb2
class
FileSyncBase
(
abc
.
ABC
):
@abc.abstractmethod
async
def
DiffCopy
(
self
,
stream
):
pass
@abc.abstractmethod
async
def
TarStream
(
self
,
stream
):
pass
def
__mapping__
(
self
):
return
{
'/moby.filesync.v1.FileSync/DiffCopy'
:
grpclib
.
const
.
Handler
(
self
.
DiffCopy
,
grpclib
.
const
.
Cardinality
.
STREAM_STREAM
,
filesync_pb2
.
BytesMessage
,
filesync_pb2
.
BytesMessage
,
),
'/moby.filesync.v1.FileSync/TarStream'
:
grpclib
.
const
.
Handler
(
self
.
TarStream
,
grpclib
.
const
.
Cardinality
.
STREAM_STREAM
,
filesync_pb2
.
BytesMessage
,
filesync_pb2
.
BytesMessage
,
),
}
class
FileSyncStub
:
def
__init__
(
self
,
channel
:
grpclib
.
client
.
Channel
)
->
None
:
self
.
DiffCopy
=
grpclib
.
client
.
StreamStreamMethod
(
channel
,
'/moby.filesync.v1.FileSync/DiffCopy'
,
filesync_pb2
.
BytesMessage
,
filesync_pb2
.
BytesMessage
,
)
self
.
TarStream
=
grpclib
.
client
.
StreamStreamMethod
(
channel
,
'/moby.filesync.v1.FileSync/TarStream'
,
filesync_pb2
.
BytesMessage
,
filesync_pb2
.
BytesMessage
,
)
class
FileSendBase
(
abc
.
ABC
):
@abc.abstractmethod
async
def
DiffCopy
(
self
,
stream
):
pass
def
__mapping__
(
self
):
return
{
'/moby.filesync.v1.FileSend/DiffCopy'
:
grpclib
.
const
.
Handler
(
self
.
DiffCopy
,
grpclib
.
const
.
Cardinality
.
STREAM_STREAM
,
filesync_pb2
.
BytesMessage
,
filesync_pb2
.
BytesMessage
,
),
}
class
FileSendStub
:
def
__init__
(
self
,
channel
:
grpclib
.
client
.
Channel
)
->
None
:
self
.
DiffCopy
=
grpclib
.
client
.
StreamStreamMethod
(
channel
,
'/moby.filesync.v1.FileSend/DiffCopy'
,
filesync_pb2
.
BytesMessage
,
filesync_pb2
.
BytesMessage
,
)
docker/api/buildkit/filesync/filesync_pb2.py
0 → 100644
Dosyayı görüntüle @
941b3054
# Generated by the protocol buffer compiler. DO NOT EDIT!
# source: filesync.proto
import
sys
_b
=
sys
.
version_info
[
0
]
<
3
and
(
lambda
x
:
x
)
or
(
lambda
x
:
x
.
encode
(
'latin1'
))
from
google.protobuf
import
descriptor
as
_descriptor
from
google.protobuf
import
message
as
_message
from
google.protobuf
import
reflection
as
_reflection
from
google.protobuf
import
symbol_database
as
_symbol_database
# @@protoc_insertion_point(imports)
_sym_db
=
_symbol_database
.
Default
()
DESCRIPTOR
=
_descriptor
.
FileDescriptor
(
name
=
'filesync.proto'
,
package
=
'moby.filesync.v1'
,
syntax
=
'proto3'
,
serialized_options
=
_b
(
'Z
\010
filesync'
),
serialized_pb
=
_b
(
'
\n\x0e\x66
ilesync.proto
\x12\x10
moby.filesync.v1
\"\x1c\n\x0c\x42
ytesMessage
\x12\x0c\n\x04\x64\x61
ta
\x18\x01
\x01
(
\x0c\x32\xab\x01\n\x08\x46
ileSync
\x12
N
\n\x08\x44
iffCopy
\x12\x1e
.moby.filesync.v1.BytesMessage
\x1a\x1e
.moby.filesync.v1.BytesMessage(
\x01\x30\x01\x12
O
\n\t
TarStream
\x12\x1e
.moby.filesync.v1.BytesMessage
\x1a\x1e
.moby.filesync.v1.BytesMessage(
\x01\x30\x01\x32
Z
\n\x08\x46
ileSend
\x12
N
\n\x08\x44
iffCopy
\x12\x1e
.moby.filesync.v1.BytesMessage
\x1a\x1e
.moby.filesync.v1.BytesMessage(
\x01\x30\x01\x42\n
Z
\x08\x66
ilesyncb
\x06
proto3'
)
)
_BYTESMESSAGE
=
_descriptor
.
Descriptor
(
name
=
'BytesMessage'
,
full_name
=
'moby.filesync.v1.BytesMessage'
,
filename
=
None
,
file
=
DESCRIPTOR
,
containing_type
=
None
,
fields
=
[
_descriptor
.
FieldDescriptor
(
name
=
'data'
,
full_name
=
'moby.filesync.v1.BytesMessage.data'
,
index
=
0
,
number
=
1
,
type
=
12
,
cpp_type
=
9
,
label
=
1
,
has_default_value
=
False
,
default_value
=
_b
(
""
),
message_type
=
None
,
enum_type
=
None
,
containing_type
=
None
,
is_extension
=
False
,
extension_scope
=
None
,
serialized_options
=
None
,
file
=
DESCRIPTOR
),
],
extensions
=
[
],
nested_types
=
[],
enum_types
=
[
],
serialized_options
=
None
,
is_extendable
=
False
,
syntax
=
'proto3'
,
extension_ranges
=
[],
oneofs
=
[
],
serialized_start
=
36
,
serialized_end
=
64
,
)
DESCRIPTOR
.
message_types_by_name
[
'BytesMessage'
]
=
_BYTESMESSAGE
_sym_db
.
RegisterFileDescriptor
(
DESCRIPTOR
)
BytesMessage
=
_reflection
.
GeneratedProtocolMessageType
(
'BytesMessage'
,
(
_message
.
Message
,),
dict
(
DESCRIPTOR
=
_BYTESMESSAGE
,
__module__
=
'filesync_pb2'
# @@protoc_insertion_point(class_scope:moby.filesync.v1.BytesMessage)
))
_sym_db
.
RegisterMessage
(
BytesMessage
)
DESCRIPTOR
.
_options
=
None
_FILESYNC
=
_descriptor
.
ServiceDescriptor
(
name
=
'FileSync'
,
full_name
=
'moby.filesync.v1.FileSync'
,
file
=
DESCRIPTOR
,
index
=
0
,
serialized_options
=
None
,
serialized_start
=
67
,
serialized_end
=
238
,
methods
=
[
_descriptor
.
MethodDescriptor
(
name
=
'DiffCopy'
,
full_name
=
'moby.filesync.v1.FileSync.DiffCopy'
,
index
=
0
,
containing_service
=
None
,
input_type
=
_BYTESMESSAGE
,
output_type
=
_BYTESMESSAGE
,
serialized_options
=
None
,
),
_descriptor
.
MethodDescriptor
(
name
=
'TarStream'
,
full_name
=
'moby.filesync.v1.FileSync.TarStream'
,
index
=
1
,
containing_service
=
None
,
input_type
=
_BYTESMESSAGE
,
output_type
=
_BYTESMESSAGE
,
serialized_options
=
None
,
),
])
_sym_db
.
RegisterServiceDescriptor
(
_FILESYNC
)
DESCRIPTOR
.
services_by_name
[
'FileSync'
]
=
_FILESYNC
_FILESEND
=
_descriptor
.
ServiceDescriptor
(
name
=
'FileSend'
,
full_name
=
'moby.filesync.v1.FileSend'
,
file
=
DESCRIPTOR
,
index
=
1
,
serialized_options
=
None
,
serialized_start
=
240
,
serialized_end
=
330
,
methods
=
[
_descriptor
.
MethodDescriptor
(
name
=
'DiffCopy'
,
full_name
=
'moby.filesync.v1.FileSend.DiffCopy'
,
index
=
0
,
containing_service
=
None
,
input_type
=
_BYTESMESSAGE
,
output_type
=
_BYTESMESSAGE
,
serialized_options
=
None
,
),
])
_sym_db
.
RegisterServiceDescriptor
(
_FILESEND
)
DESCRIPTOR
.
services_by_name
[
'FileSend'
]
=
_FILESEND
# @@protoc_insertion_point(module_scope)
docker/api/buildkit/grpc.py
0 → 100644
Dosyayı görüntüle @
941b3054
import
grpclib.server
class
Handler
(
grpclib
.
server
.
Handler
):
def
__init__
(
self
,
headers
,
*
args
,
**
kwargs
):
self
.
headers
=
headers
super
(
Handler
,
self
)
.
__init__
(
*
args
,
**
kwargs
)
def
accept
(
self
,
stream
,
headers
,
release_stream
):
for
k
,
v
in
self
.
headers
.
items
():
headers
.
setdefault
(
k
,
v
)
class
Server
(
grpclib
.
server
.
Server
):
headers
=
{}
def
add_headers
(
self
,
h
):
self
.
headers
.
update
(
h
)
def
_protocol_factory
(
self
):
self
.
__gc_step__
()
handler
=
Handler
(
self
.
headers
,
self
.
_mapping
,
self
.
_codec
,
loop
=
self
.
_loop
)
self
.
_handlers
.
add
(
handler
)
return
grpclib
.
server
.
H2Protocol
(
handler
,
self
.
_config
,
loop
=
self
.
_loop
)
class
Attachable
(
object
):
def
register
(
self
,
grpc_server
):
grpc_server
.
_mapping
.
update
(
self
.
__mapping__
())
docker/api/buildkit/session.py
Dosyayı görüntüle @
941b3054
import
asyncio
import
binascii
import
concurrent.futures
import
hashlib
import
os
import
base36
import
grpc
from
grpc_health.v1
import
health_pb2_grpc
import
grpclib.server
from
docker.utils
import
version_gte
from
docker.utils.config
import
config_dir
headerSession
ID
=
"X-Docker-Expose-Session-Uuid"
headerSessionName
=
"X-Docker-Expose-Session-Name"
headerSessionSharedKey
=
"X-Docker-Expose-Session-Sharedkey"
headerSessionMethod
=
"X-Docker-Expose-Session-Grpc-Method"
HEADER_SESSION_
ID
=
"X-Docker-Expose-Session-Uuid"
HEADER_SESSION_NAME
=
"X-Docker-Expose-Session-Name"
HEADER_SESSION_SHAREDKEY
=
"X-Docker-Expose-Session-Sharedkey"
HEADER_SESSION_METHOD
=
"X-Docker-Expose-Session-Grpc-Method"
def
is_session_supported
(
client
,
for_stream
):
...
...
@@ -68,23 +67,39 @@ class Session(object):
self
.
id
=
generate_session_id
()
self
.
name
=
name
self
.
shared_key
=
shared_key
self
.
grpc_server
=
grpc
.
server
(
concurrent
.
futures
.
ThreadPoolExecutor
(
max_workers
=
10
)
)
health_pb2_grpc
.
add_HealthServicer_to_server
(
health_pb2_grpc
.
HealthServicer
(),
self
.
grpc_server
self
.
grpc_server
=
grpclib
.
server
.
Server
(
[],
asyncio
.
get_event_loop
()
)
self
.
sock
=
None
def
allow
(
self
,
attachable
):
attachable
.
register
(
self
.
grpc_server
)
def
run
(
self
,
dialer
):
def
run
(
self
,
sock
):
meta
=
{
headerSession
ID
:
self
.
id
,
headerSessionName
:
self
.
name
,
headerSessionSharedKey
:
self
.
shared_key
,
HEADER_SESSION_
ID
:
self
.
id
,
HEADER_SESSION_NAME
:
self
.
name
,
HEADER_SESSION_SHAREDKEY
:
self
.
shared_key
,
}
# for name, svc
\ No newline at end of file
# FIXME: some loop for headerSessionMethod
self
.
sock
=
sock
await
self
.
serve
(
meta
)
async
def
serve
(
self
,
metadata
):
# FIXME: Figure out what to do with metadata
await
self
.
grpc_server
.
start
(
sock
=
self
.
sock
)
print
(
'Serving on socket {}'
.
format
(
self
.
sock
))
try
:
await
self
.
grpc_server
.
wait_closed
()
except
asyncio
.
CancelledError
:
self
.
grpc_server
.
close
()
await
self
.
grpc_server
.
wait_closed
()
def
close
(
self
):
if
self
.
sock
:
self
.
sock
.
close
()
self
.
grpc_server
.
close
()
self
.
closed
=
True
docker/api/daemon.py
Dosyayı görüntüle @
941b3054
...
...
@@ -185,6 +185,18 @@ class DaemonApiMixin(object):
return
types
.
ServerInfo
(
resp
.
headers
)
def
session
(
self
,
protocol
):
url
=
self
.
_url
(
"/session"
)
headers
=
{
'Connection'
:
'Upgrade'
,
'Upgrade'
:
protocol
,
}
resp
=
self
.
_post
(
url
,
headers
=
headers
,
stream
=
True
)
self
.
_raise_for_status
(
resp
)
return
self
.
_get_raw_response_socket
(
resp
)
def
version
(
self
,
api_version
=
True
):
"""
Returns version information from the server. Similar to the ``docker
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment