486
486
return SuccessfulSmartServerResponse((answer,))
489
# In the 'info' attribute, we store whether this request is 'safe' to retry if
490
# we get a disconnect while reading the response. It can have the values:
491
# safe The request is strictly idempotent, calling it twice results in
492
# the same result as calling it one time. This includes all read-only
493
# requests, and write requests like 'put' where the end result is
495
# unsafe A request which is unsafe means that state is updated in a way that
496
# replaying that request results in a different state. For example
497
# 'append' writes more bytes to a given file. If append succeeds, it
498
# moves the file pointer.
499
# semi This is a request that isn't strictly idempotent, but doesn't
500
# result in corruption if it is retried. This is for things like
501
# 'lock' and 'unlock'. If you call lock, it updates the disk
502
# structure. If you fail to read the response, you won't be able to
503
# use the lock, because you don't have the lock token. Calling lock
504
# again will fail, because the lock is already taken. However, we
505
# can't tell if the server received our request or not. If it didn't,
506
# then retrying the request is fine, as it will actually do what we
507
# want. If it did, we will interrupt the current operation, but we
508
# are no worse off than interrupting the current operation because of
510
# stream This is a request that takes a stream that cannot be restarted if
511
# consumed. This request is 'safe' in that if we determine the
512
# connection is closed before we consume the stream, we can try
489
514
request_handlers = registry.Registry()
490
515
request_handlers.register_lazy(
491
'append', 'bzrlib.smart.vfs', 'AppendRequest')
516
'append', 'bzrlib.smart.vfs', 'AppendRequest', info='unsafe')
492
517
request_handlers.register_lazy(
493
518
'Branch.get_config_file', 'bzrlib.smart.branch',
494
'SmartServerBranchGetConfigFile')
519
'SmartServerBranchGetConfigFile', info='safe')
495
520
request_handlers.register_lazy(
496
'Branch.get_parent', 'bzrlib.smart.branch', 'SmartServerBranchGetParent')
521
'Branch.get_parent', 'bzrlib.smart.branch', 'SmartServerBranchGetParent',
497
523
request_handlers.register_lazy(
498
524
'Branch.get_tags_bytes', 'bzrlib.smart.branch',
499
'SmartServerBranchGetTagsBytes')
525
'SmartServerBranchGetTagsBytes', info='safe')
500
526
request_handlers.register_lazy(
501
527
'Branch.set_tags_bytes', 'bzrlib.smart.branch',
502
'SmartServerBranchSetTagsBytes')
503
request_handlers.register_lazy(
504
'Branch.get_stacked_on_url', 'bzrlib.smart.branch', 'SmartServerBranchRequestGetStackedOnURL')
505
request_handlers.register_lazy(
506
'Branch.last_revision_info', 'bzrlib.smart.branch', 'SmartServerBranchRequestLastRevisionInfo')
507
request_handlers.register_lazy(
508
'Branch.lock_write', 'bzrlib.smart.branch', 'SmartServerBranchRequestLockWrite')
528
'SmartServerBranchSetTagsBytes', info='safe')
529
request_handlers.register_lazy(
530
'Branch.get_stacked_on_url', 'bzrlib.smart.branch',
531
'SmartServerBranchRequestGetStackedOnURL', info='safe')
532
request_handlers.register_lazy(
533
'Branch.last_revision_info', 'bzrlib.smart.branch',
534
'SmartServerBranchRequestLastRevisionInfo', info='safe')
535
request_handlers.register_lazy(
536
'Branch.lock_write', 'bzrlib.smart.branch',
537
'SmartServerBranchRequestLockWrite', info='semi')
509
538
request_handlers.register_lazy( 'Branch.revision_history',
510
'bzrlib.smart.branch', 'SmartServerRequestRevisionHistory')
539
'bzrlib.smart.branch', 'SmartServerRequestRevisionHistory',
511
541
request_handlers.register_lazy( 'Branch.set_config_option',
512
'bzrlib.smart.branch', 'SmartServerBranchRequestSetConfigOption')
542
'bzrlib.smart.branch', 'SmartServerBranchRequestSetConfigOption',
513
544
request_handlers.register_lazy( 'Branch.set_last_revision',
514
'bzrlib.smart.branch', 'SmartServerBranchRequestSetLastRevision')
545
'bzrlib.smart.branch', 'SmartServerBranchRequestSetLastRevision',
515
547
request_handlers.register_lazy(
516
548
'Branch.set_last_revision_info', 'bzrlib.smart.branch',
517
'SmartServerBranchRequestSetLastRevisionInfo')
549
'SmartServerBranchRequestSetLastRevisionInfo', info='safe')
518
550
request_handlers.register_lazy(
519
551
'Branch.set_last_revision_ex', 'bzrlib.smart.branch',
520
'SmartServerBranchRequestSetLastRevisionEx')
552
'SmartServerBranchRequestSetLastRevisionEx', info='safe')
521
553
request_handlers.register_lazy(
522
554
'Branch.set_parent_location', 'bzrlib.smart.branch',
523
'SmartServerBranchRequestSetParentLocation')
555
'SmartServerBranchRequestSetParentLocation', info='safe')
524
556
request_handlers.register_lazy(
525
'Branch.unlock', 'bzrlib.smart.branch', 'SmartServerBranchRequestUnlock')
557
'Branch.unlock', 'bzrlib.smart.branch', 'SmartServerBranchRequestUnlock',
526
559
request_handlers.register_lazy(
527
560
'BzrDir.cloning_metadir', 'bzrlib.smart.bzrdir',
528
'SmartServerBzrDirRequestCloningMetaDir')
561
'SmartServerBzrDirRequestCloningMetaDir', info='safe')
529
562
request_handlers.register_lazy(
530
563
'BzrDir.create_branch', 'bzrlib.smart.bzrdir',
531
'SmartServerRequestCreateBranch')
564
'SmartServerRequestCreateBranch', info='semi')
532
565
request_handlers.register_lazy(
533
566
'BzrDir.create_repository', 'bzrlib.smart.bzrdir',
534
'SmartServerRequestCreateRepository')
567
'SmartServerRequestCreateRepository', info='semi')
535
568
request_handlers.register_lazy(
536
569
'BzrDir.find_repository', 'bzrlib.smart.bzrdir',
537
'SmartServerRequestFindRepositoryV1')
570
'SmartServerRequestFindRepositoryV1', info='safe')
538
571
request_handlers.register_lazy(
539
572
'BzrDir.find_repositoryV2', 'bzrlib.smart.bzrdir',
540
'SmartServerRequestFindRepositoryV2')
573
'SmartServerRequestFindRepositoryV2', info='safe')
541
574
request_handlers.register_lazy(
542
575
'BzrDir.find_repositoryV3', 'bzrlib.smart.bzrdir',
543
'SmartServerRequestFindRepositoryV3')
576
'SmartServerRequestFindRepositoryV3', info='safe')
544
577
request_handlers.register_lazy(
545
578
'BzrDir.get_config_file', 'bzrlib.smart.bzrdir',
546
'SmartServerBzrDirRequestConfigFile')
579
'SmartServerBzrDirRequestConfigFile', info='safe')
547
580
request_handlers.register_lazy(
548
581
'BzrDirFormat.initialize', 'bzrlib.smart.bzrdir',
549
'SmartServerRequestInitializeBzrDir')
582
'SmartServerRequestInitializeBzrDir', info='semi')
550
583
request_handlers.register_lazy(
551
584
'BzrDirFormat.initialize_ex_1.16', 'bzrlib.smart.bzrdir',
552
'SmartServerRequestBzrDirInitializeEx')
553
request_handlers.register_lazy(
554
'BzrDir.open', 'bzrlib.smart.bzrdir', 'SmartServerRequestOpenBzrDir')
555
request_handlers.register_lazy(
556
'BzrDir.open_2.1', 'bzrlib.smart.bzrdir', 'SmartServerRequestOpenBzrDir_2_1')
585
'SmartServerRequestBzrDirInitializeEx', info='semi')
586
request_handlers.register_lazy(
587
'BzrDir.open', 'bzrlib.smart.bzrdir', 'SmartServerRequestOpenBzrDir',
589
request_handlers.register_lazy(
590
'BzrDir.open_2.1', 'bzrlib.smart.bzrdir',
591
'SmartServerRequestOpenBzrDir_2_1', info='safe')
557
592
request_handlers.register_lazy(
558
593
'BzrDir.open_branch', 'bzrlib.smart.bzrdir',
559
'SmartServerRequestOpenBranch')
594
'SmartServerRequestOpenBranch', info='safe')
560
595
request_handlers.register_lazy(
561
596
'BzrDir.open_branchV2', 'bzrlib.smart.bzrdir',
562
'SmartServerRequestOpenBranchV2')
597
'SmartServerRequestOpenBranchV2', info='safe')
563
598
request_handlers.register_lazy(
564
599
'BzrDir.open_branchV3', 'bzrlib.smart.bzrdir',
565
'SmartServerRequestOpenBranchV3')
566
request_handlers.register_lazy(
567
'delete', 'bzrlib.smart.vfs', 'DeleteRequest')
568
request_handlers.register_lazy(
569
'get', 'bzrlib.smart.vfs', 'GetRequest')
570
request_handlers.register_lazy(
571
'get_bundle', 'bzrlib.smart.request', 'GetBundleRequest')
572
request_handlers.register_lazy(
573
'has', 'bzrlib.smart.vfs', 'HasRequest')
574
request_handlers.register_lazy(
575
'hello', 'bzrlib.smart.request', 'HelloRequest')
576
request_handlers.register_lazy(
577
'iter_files_recursive', 'bzrlib.smart.vfs', 'IterFilesRecursiveRequest')
578
request_handlers.register_lazy(
579
'list_dir', 'bzrlib.smart.vfs', 'ListDirRequest')
580
request_handlers.register_lazy(
581
'mkdir', 'bzrlib.smart.vfs', 'MkdirRequest')
582
request_handlers.register_lazy(
583
'move', 'bzrlib.smart.vfs', 'MoveRequest')
584
request_handlers.register_lazy(
585
'put', 'bzrlib.smart.vfs', 'PutRequest')
586
request_handlers.register_lazy(
587
'put_non_atomic', 'bzrlib.smart.vfs', 'PutNonAtomicRequest')
588
request_handlers.register_lazy(
589
'readv', 'bzrlib.smart.vfs', 'ReadvRequest')
590
request_handlers.register_lazy(
591
'rename', 'bzrlib.smart.vfs', 'RenameRequest')
600
'SmartServerRequestOpenBranchV3', info='safe')
601
request_handlers.register_lazy(
602
'delete', 'bzrlib.smart.vfs', 'DeleteRequest', info='semi')
603
request_handlers.register_lazy(
604
'get', 'bzrlib.smart.vfs', 'GetRequest', info='safe')
605
request_handlers.register_lazy(
606
'get_bundle', 'bzrlib.smart.request', 'GetBundleRequest', info='safe')
607
request_handlers.register_lazy(
608
'has', 'bzrlib.smart.vfs', 'HasRequest', info='safe')
609
request_handlers.register_lazy(
610
'hello', 'bzrlib.smart.request', 'HelloRequest', info='safe')
611
request_handlers.register_lazy(
612
'iter_files_recursive', 'bzrlib.smart.vfs', 'IterFilesRecursiveRequest',
614
request_handlers.register_lazy(
615
'list_dir', 'bzrlib.smart.vfs', 'ListDirRequest', info='safe')
616
request_handlers.register_lazy(
617
'mkdir', 'bzrlib.smart.vfs', 'MkdirRequest', info='semi')
618
request_handlers.register_lazy(
619
'move', 'bzrlib.smart.vfs', 'MoveRequest', info='semi')
620
request_handlers.register_lazy(
621
'put', 'bzrlib.smart.vfs', 'PutRequest', info='safe')
622
request_handlers.register_lazy(
623
'put_non_atomic', 'bzrlib.smart.vfs', 'PutNonAtomicRequest', info='safe')
624
request_handlers.register_lazy(
625
'readv', 'bzrlib.smart.vfs', 'ReadvRequest', info='safe')
626
request_handlers.register_lazy(
627
'rename', 'bzrlib.smart.vfs', 'RenameRequest', info='semi')
592
628
request_handlers.register_lazy(
593
629
'PackRepository.autopack', 'bzrlib.smart.packrepository',
594
'SmartServerPackRepositoryAutopack')
595
request_handlers.register_lazy('Repository.gather_stats',
596
'bzrlib.smart.repository',
597
'SmartServerRepositoryGatherStats')
598
request_handlers.register_lazy('Repository.get_parent_map',
599
'bzrlib.smart.repository',
600
'SmartServerRepositoryGetParentMap')
601
request_handlers.register_lazy(
602
'Repository.get_revision_graph', 'bzrlib.smart.repository', 'SmartServerRepositoryGetRevisionGraph')
603
request_handlers.register_lazy(
604
'Repository.has_revision', 'bzrlib.smart.repository', 'SmartServerRequestHasRevision')
605
request_handlers.register_lazy(
606
'Repository.insert_stream', 'bzrlib.smart.repository', 'SmartServerRepositoryInsertStream')
607
request_handlers.register_lazy(
608
'Repository.insert_stream_1.19', 'bzrlib.smart.repository', 'SmartServerRepositoryInsertStream_1_19')
609
request_handlers.register_lazy(
610
'Repository.insert_stream_locked', 'bzrlib.smart.repository', 'SmartServerRepositoryInsertStreamLocked')
611
request_handlers.register_lazy(
612
'Repository.is_shared', 'bzrlib.smart.repository', 'SmartServerRepositoryIsShared')
613
request_handlers.register_lazy(
614
'Repository.lock_write', 'bzrlib.smart.repository', 'SmartServerRepositoryLockWrite')
630
'SmartServerPackRepositoryAutopack', info='safe')
631
request_handlers.register_lazy(
632
'Repository.gather_stats', 'bzrlib.smart.repository',
633
'SmartServerRepositoryGatherStats', info='safe')
634
request_handlers.register_lazy(
635
'Repository.get_parent_map', 'bzrlib.smart.repository',
636
'SmartServerRepositoryGetParentMap', info='safe')
637
request_handlers.register_lazy(
638
'Repository.get_revision_graph', 'bzrlib.smart.repository',
639
'SmartServerRepositoryGetRevisionGraph', info='safe')
640
request_handlers.register_lazy(
641
'Repository.has_revision', 'bzrlib.smart.repository',
642
'SmartServerRequestHasRevision', info='safe')
643
request_handlers.register_lazy(
644
'Repository.insert_stream', 'bzrlib.smart.repository',
645
'SmartServerRepositoryInsertStream', info='stream')
646
request_handlers.register_lazy(
647
'Repository.insert_stream_1.19', 'bzrlib.smart.repository',
648
'SmartServerRepositoryInsertStream_1_19', info='stream')
649
request_handlers.register_lazy(
650
'Repository.insert_stream_locked', 'bzrlib.smart.repository',
651
'SmartServerRepositoryInsertStreamLocked', info='stream')
652
request_handlers.register_lazy(
653
'Repository.is_shared', 'bzrlib.smart.repository',
654
'SmartServerRepositoryIsShared', info='safe')
655
request_handlers.register_lazy(
656
'Repository.lock_write', 'bzrlib.smart.repository',
657
'SmartServerRepositoryLockWrite', info='semi')
615
658
request_handlers.register_lazy(
616
659
'Repository.set_make_working_trees', 'bzrlib.smart.repository',
617
'SmartServerRepositorySetMakeWorkingTrees')
660
'SmartServerRepositorySetMakeWorkingTrees', info='safe')
618
661
request_handlers.register_lazy(
619
'Repository.unlock', 'bzrlib.smart.repository', 'SmartServerRepositoryUnlock')
662
'Repository.unlock', 'bzrlib.smart.repository',
663
'SmartServerRepositoryUnlock', info='semi')
620
664
request_handlers.register_lazy(
621
665
'Repository.get_rev_id_for_revno', 'bzrlib.smart.repository',
622
'SmartServerRepositoryGetRevIdForRevno')
666
'SmartServerRepositoryGetRevIdForRevno', info='safe')
623
667
request_handlers.register_lazy(
624
668
'Repository.get_stream', 'bzrlib.smart.repository',
625
'SmartServerRepositoryGetStream')
669
'SmartServerRepositoryGetStream', info='safe')
626
670
request_handlers.register_lazy(
627
671
'Repository.get_stream_1.19', 'bzrlib.smart.repository',
628
'SmartServerRepositoryGetStream_1_19')
672
'SmartServerRepositoryGetStream_1_19', info='safe')
629
673
request_handlers.register_lazy(
630
674
'Repository.tarball', 'bzrlib.smart.repository',
631
'SmartServerRepositoryTarball')
632
request_handlers.register_lazy(
633
'rmdir', 'bzrlib.smart.vfs', 'RmdirRequest')
634
request_handlers.register_lazy(
635
'stat', 'bzrlib.smart.vfs', 'StatRequest')
636
request_handlers.register_lazy(
637
'Transport.is_readonly', 'bzrlib.smart.request', 'SmartServerIsReadonly')
675
'SmartServerRepositoryTarball', info='safe')
676
request_handlers.register_lazy(
677
'rmdir', 'bzrlib.smart.vfs', 'RmdirRequest', info='semi')
678
request_handlers.register_lazy(
679
'stat', 'bzrlib.smart.vfs', 'StatRequest', info='safe')
680
request_handlers.register_lazy(
681
'Transport.is_readonly', 'bzrlib.smart.request', 'SmartServerIsReadonly',